You are on page 1of 8

Report

TP2
Linux administration

2021/2022

Created by : NKHILI Ouiame

1er année IRISTI


Contents :
 Listing Files
 Metacharacters
 Hidden Files
 Display Content of a File
 Counting Words in a File
 Copying Files
 Renaming Files
 Deleting Files
 Home Directory
 Absolute/Relative Pathnames
 Listing Directories
 Creating Directories
 Creating Parent Directories
 Removing Directories
 Changing Directories
 Renaming Directories
 The directories . (dot) and .. (dot dot
Listing Files
To list the files and directories stored in the current directory, use the following command

$ls

Syntax :

$ls-l

The command ls supports the -l option which would help you to get more information about
the listed files

Synatx :

- :Regular file, such as an ASCII text file, binary executable, or hard link.

B :Block special file. Block input/output device file such as a physical hard drive.

C :Character special file. Raw input/output device file such as a physical hard drive.

D :Directory file that contains a listing of other files and directories.

L :Symbolic link file. Links on any regular file.

P :Named pipe. A mechanism for interprocess communications.

s :Socket used for interprocess communication.

Metacharacters
$ls ch*.doc
Displays all the files, the names of which start with ch and end with .doc

$ls *.doc

* works as meta character which matches with any character. If you want to display all the
files ending with just .doc, then you can use the following command

Hidden Files
To list the invisible files, specify the -a option to ls –

$ ls –a

Syntax :

• Single dot (.) − This represents the current directory.

• Double dot (..) − This represents the parent directory.

Creating Files
$ vi filename

Syntax :

Display Content of a File


$ cat filename
$ cat -b filename

Syntax :

Counting Words in a File


$ wc filename

$ wc filename1 filename2 filename3

Syntax :

Copying Files
$ cp filename copyfile

Syntax :

Renaming Files
$ mv old_file new_file

$ mv filename newfile

Syntax :
Deleting Files
$ rm filename

$ rm filename1 filename2 filename3

Syntax :

Home Directory
$cd ~username

Syntax :

Absolute/Relative Pathnames
$pwd

Syntax :

Listing Directories
$ls /usr/local

Syntax :

Creating Directories
$mkdir dirname

$mkdir mydir

$mkdir /tmp/test-dir

$mkdir docs pub

Creating Parent Directories


$mkdir /tmp/amrood/test

$mkdir -p /tmp/amrood/test

Removing Directories
$rmdir dirname

$rmdir dirname1 dirname2 dirname3


$

Changing Directories
$cd dirname

Renaming Directories
$mv olddir newdir

The directories . (dot) and .. (dot dot)


$ls –la

You might also like