0% found this document useful (0 votes)
3 views3 pages

TP 1

The document provides an introduction to basic Linux commands including 'pwd' for printing the current directory, 'man' for accessing manual pages, and 'ls' for listing directory contents. It also explains the Filesystem Hierarchy Standard (FHS) which outlines the structure and purpose of various directories in a Linux system. Additionally, it includes tasks for practicing these commands and understanding the file system layout.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

TP 1

The document provides an introduction to basic Linux commands including 'pwd' for printing the current directory, 'man' for accessing manual pages, and 'ls' for listing directory contents. It also explains the Filesystem Hierarchy Standard (FHS) which outlines the structure and purpose of various directories in a Linux system. Additionally, it includes tasks for practicing these commands and understanding the file system layout.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

TP1 - Introduction

Task 1: The command "pwd" stands for "print working directory." When you run the "pwd"
command in a terminal, it will display the full path of the current directory you are in. This
means it will show the hierarchy of directories you would have to navigate through in order to
reach the current location in the file system.
1. Open a terminal window.
2. Use the command pwd to check your current directory.
3. In which directory you are?
/home/nero

Task 2: The command "man" stands for "manual." When you run the "man" command in a
terminal, followed by the name of a command, it will display the manual pages for that
command. The manual pages (or "man pages" for short) contain detailed information about the
command, including its syntax, options, and usage examples.
/usr/share/man is the location on a common Linux system where the manual pages (or "man
pages") are stored. This directory contains subdirectories for each section of the manual page.
The most used sections are:
• Section 1: User Commands - contains information on commands that are intended to be
run by users.
• Section 2: System Calls - contains information on system calls that are used by the
kernel and other system software. A system call is a request made by a user-level
program to the operating system's kernel for a service or resource. The manual page for
the command includes its usage, return values, and any error conditions that may occur.
• Section 3: Library Functions - contains information on functions that are part of the C
library and can be called from C programs. For example, if you run the command "man
3 printf" it will display the manual page for the "printf" function. This page contains
information about the printf function, including its usage, arguments, return values, and
any error conditions that may occur.
• Section 4: Devices and Special Files - contains information on devices and special files
in the file system (usually in /dev). Devices are hardware components that can be
accessed by the operating system and special files are files that are used to access
specific system resources like system memory and network interfaces.
• Section 5: File Formats and Conventions - contains information on file formats and
conventions used. For example, if you run the command "man 5 passwd" it will display
the manual page for the "passwd" file format. This page contains information about the
passwd file format, including the format of the fields, and the meaning of each field.
• Section 6: Games and Demos - contains information on games and other fun programs.
The games that are available will depend on the specific operating system and
distribution you are using.
• Section 7: Various - contains information that does not fit in any other section. This
section usually contains information about conventions, file formats, and system
administration commands that are not specific to a particular program. For example, if
you run the command "man 7 signal" it will display the manual page for the "signal"
topic. This page contains a list of the signals that the operating system can send to a
process and a brief description of what happens when each signal is received.
• Section 8: Administration commands - This section usually contains information about
commands that are intended to be run by the system administrator, rather than by regular
users. These commands often require superuser privileges and are intended to be used
for tasks such as system configuration, maintenance, and management.
For example, if you run the command "man 8 cron" it will display the manual page for
the "cron" daemon. This page contains information about the cron daemon, which is a
system service that runs in the background and executes commands at specified
intervals. The manual page will describe the basic usage, configuration file syntax and
options.
• Section 9: Kernel routines - contains information specific to the kernel and kernel
modules. This section usually contains information about the kernel's internal interfaces,
protocols, and data structures. This section is intended for developers and advanced
users who are working with the kernel itself, rather than with user-level programs. The
information in this section is usually very technical and requires a good understanding
of operating system and kernel internals.

1. Use the command man 1 pwd (the same as "man pwd")


2. To access the package that contains the Linux developer's manual, you have to install
the package "manpages-dev" by using the command sudo apt install manpages-dev

Task 3: The command "ls" stands for "list." When you run the "ls" command in a terminal, it
will display a list of the files and directories within the current working directory.
1. Use the command ls /usr/share/man
2. Use the command ls -> displays directories in the home directory
3. Display the list in a long format, which includes additional information about each file
and directory, such as permissions, file size, and timestamp
a. what does the first column show? Second column? Third column? Fourth
column? Fifth column? Last column?
b. The first column of the output generated by the command, is a series of 10
google characters. What does the first character indicate?
The next 9 characters are divided into three groups of three. What does the group
of three characters represent? What does the letters represented in each group
mean? And what does indicate the character '-'?
4. Display files and directories in long format, including hidden files.
5. Display files and directories in long format ordered by last modification time, from most
recently modified to least recently modified.
6. Display files and directories in long format and sort by the time they were last modified
in reverse order.
7. List the contents of a directory, including any subdirectories, recursively.
8. List the contents in the user's home directory that have a 6-character name.
9. List the contents in the user's home directory that start with the letter 'D' or 'd'. ls [Dd]*
10. List the contents in the user's home directory that start with the word "Do" or "Pu". ls Do*
11. List the contents in the user's home directory that start with the word "Do" or "Pu"
followed by a character not 'w'.
file permissions, ls Do [^w]* Pu[^w]*
number of links,
owner name,
owner group,
file size,
timestamp of last modification,
and file/directory name.
Task 4: The command "cd" (short for "change directory") is used in a Unix-based operating
system such as Linux to change the current working directory. When you run the command
"cd" followed by a directory path, it changes the current working directory to the specified
directory path. For example, if you are currently in the directory "/home/user" and you want to
change to the directory "/home/user/documents", you would use the command "cd documents".
1. Change the user's home directory to the parent directory.
2. Change the current directory to the previous directory.
3. Change the current directory to the root directory.
4. Change the current directory to the user's home directory (don’t use absolute path).
5. Change the current directory to the root directory (don’t use absolute path).

Task 5: FHS stands for "Filesystem Hierarchy Standard", which is a standard for the layout of
the file system on Unix and Unix-like operating systems, such as Linux. It provides a consistent
way of organizing files and directories on a Linux system and helps to ensure compatibility and
ease of use. The FHS standard defines a directory structure that includes a root directory,
represented by the '/' character, with a number of subdirectories, each with a specific purpose.
Some of the main directories defined by the FHS include:
/bin Binary executable files
/boot Static files of the bootloader & static files of the
Linux kernel
/dev Device files from physical and logical devices

/etc Configuration files


/home Contains user's home directories
/lib Shared libraries and kernel modules
/media Mount point for removable media
/mnt Mount point for temporarily mounted file system

/opt Additional / optional programs


/root /Home directory of root
/run Relevant data for ongoing processes
/sbin Basic Linux command binaries that can only be
executed by root or users with root rights
/srv Data on various services
/tmp Temporary data
/usr User-related files such as programs,
documentation, and data
/var Variable files, data that is constantly changing, e.g.
Log files

1. List the content of each directory (FHS)


2. What do the following directories contain? /usr/bin, /usr/share, /usr/local, /var/cache,
/var/lock, /var/spool, /var/backups and /var/local.

You might also like