Vous êtes sur la page 1sur 11

TABLE DES MATIÈRES

1 LES COMMANDES SE 1
1.1 whoami . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 man . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 pwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 ls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.6 cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.6.1 THE ROOT DIRECTORY . . . . . . . . . . . . . . . . . . . . . . . 3
1.7 mkdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.8 touch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.9 rmdir/rm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.10 mv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.11 cp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.12 head . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.13 tail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.14 cat(concatenate) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.15 echo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.16 wc(word count) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.17 piping( | ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.18 sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.19 sudo/su . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.20 grep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.21 ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.22 top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.23 kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.24 jobs/fg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

0
CHAPITRE 1
LES COMMANDES SE

shell : A shell is a computer interface to an operating system .


shell expose the OS’s services to human users or other programs.
the shell takes our commands and give them to the operating system to perform.
it’s named the shell because it is the outer layer around the OS , like the shell around an
oyster.

1.1 whoami
get the name of the user using Ubuntu

1.2 man
a command to get the manual of others commands

1
CHAPITRE 1. LES COMMANDES SE

1.3 clear
clear the command screen
shortcut :ctrl+l

1.4 pwd
tell us our current location

1.5 ls
inside a folder you can list all the files that the folder contains using ls command.
if you add a folder name or path , it will print that folder contents
example :
ls /Document

1.6 cd
once you have a folder , you can move into it using the cd command , cd means change
directory , you invoke it specifying a folder to move into . you can specify a folder name , or
an entire path.
example :
cd Document
to go back we use :
cd .. cd ../.. go back more than one folder

why we use /

2
CHAPITRE 1. LES COMMANDES SE

1.6.1 THE ROOT DIRECTORY

the root directory is the starting point for the file system . we call it the
root , but its actual directory name is "/".
the home directory is the directory which contains the user directory which
contains all the files and the folders.

1.7 mkdir
the command used to create folders
example :
mkdir sm

can create multiples folders : mkdir sm yaser

create folders from another folders : mkdir sm/yaser (create yaser folder inside sm folder)

mkdir -p :make parent directories as needed

3
CHAPITRE 1. LES COMMANDES SE

1.8 touch
create an empty text file
historically it’s main purpose was to change file timestamps

1.9 rmdir/rm
rmdir :delete a folder(works only if the folder is empty)
rm :delete folders whether they was empty or not and files
rm -r :the way to delete the folders

rm -ri :when deleting a folder that contain other files you’ll be asked at every file,would
you like to delete it or not

1.10 mv
change names

if the last argument is a folder it will remove the file into that folder

4
CHAPITRE 1. LES COMMANDES SE

1.11 cp
make a copy of the file
example :make a copy of a file inside another file

1.12 head
output the first 10 lines of a file

1.13 tail
output the last 10 lines of a file
when adding -n option you can add more lines
example : tail cp.pdf -n 100 output the last 100 lines in cp.pdf

1.14 cat(concatenate)
Similar to tail in some way , we have cat ,except cat can also add content to a file
, and this make it super powerful.
in its simplest usage, cat prints a file’s content to the standard output :

cat cp.pdf

5
CHAPITRE 1. LES COMMANDES SE

you can print the content of multiples files


cat cp.pdf cp-cop.pdf

1.15 echo
the echo command does one simple job : it prints to the output the argument passed
to it.
example :

can also echo the text into a file even if the file doesn’t exist because it will be created
automatically
example :
echo "hello word"> hello.pdf

1.16 wc(word count)


print new line , word, and byte counts for each file
when adding
-l :print just the number of lines
-m :print just the number of characters
-c :print just the number of bytes
example : wc -l cp.pdf (will print just the number of lines)

1.17 piping( | )
NOTE :piping is not a command
taking output of a command and passing it to another command
example : how to know the number of words inside a file(or multiple file)

6
CHAPITRE 1. LES COMMANDES SE

1.18 sort
sort the files
example :

7
CHAPITRE 1. LES COMMANDES SE

1.19 sudo/su
sudo : add a user

sudo apt-get update : install an update

sudo apt install gcc : install gcc

su : change the user

1.20 grep
help us to find texts inside of files

1.21 ps
display informations about currently running processus
ps ax : ps show processus that were created by the user but ps ax show all the
processus

1.22 top
show the characteristics of the processus

1.23 kill
used basically to kill programs
the gentle way of killing a process : kill -15 (the number of the process)

the brutal way of killing a process(immediate kill) : kill -9 (the number of the process)

example : before killing the process

8
CHAPITRE 1. LES COMMANDES SE

after killing the process(the process 1364)

1.24 jobs/fg
jobs :used to see the processus running in the background

fg : fg (job’s number) :make the job run in for ground(avant-plan)

Vous aimerez peut-être aussi