-
man
-
man ls
-
Navigating the man pages
"space" Go forword one window.
"enter" Go forword one line.
G"b" Go backword one window.
"/" Search for something in the man. Eg./space : search for "space" in man
"n" Repeat previous search,"next".
"q" Exit the man page
-
manls
This command will not work because "manls" deferent than "man ls"
-
man 3 ls
This also will not work because "man 3" used to store C Standard library
-
- ls
List the content of the current directory
- ls -l
Show more details,like permissions & size
- ls -h
Make the result human readable but not in this case we need to combined it with -l and -s, print sizes like 1K 234M 2G etc.
- ls -l -h ....vs.... ls -lh
This two commands are the same, because -h & -l can be combined into one option -lh
- ls -lct
List the content sorted by the last time of modification
- ls -a
Show the hidden content as well
- ls /etc/
List the content of /etc directory - /etc: contains system configuration
- lsusb
List informations about USB buses in the system and the devices connected to them. /pre>
- ls --color
--color=auto : give each file type deferent color --color=never : this is the default(show all file types with the same color)
- cd "or" *cd ~*
Go to user home directory
- cd /
Go to root directory
- pwd
this will print "/" beacause we are in the root directory
- cd ..
Go back one level up from the current directory
- cd /usr/bin
Go to /usr/bin directory - /usr/bin: contains most of the executable files
- cd -
Change to the previous working directory & the writes its name
- Setting up a new user to practice in a clear environment
$ sudo useradd coco
$ su - coco
-
- Return to the User directory, create a new direc tory using the command "mkdir", delete this directory with "rmdir" then return to the root directory.
$ cd
$ mkdir myDir
$ rmdir myDir
$ cd /
-
- Create the directory again in the same location without changing the current directory (until further notice).
$ mkdir ~/myDir
-
- Create a file with the “touch” command in the user folder.
$ touch ~/myFile
-
- Copy the file to the directory previously created using the "cp" command, then delete the original file using the "rm" command.
$ cp ~/myFile ~/myDir/myFile
$ rm ~/myFile
-
- Move the remaining copy to the user directory using "mv", move now to the directory you created and bring the file back there again.
$ mv ~/myDir/myFile ~
$ cd ~/myDir
$ mv ../ .
-
- Make a copy of your directory and its file, in a new directory, using of "cp" using the appropriate option, what do you notice?
Running just "cp" will not work for copying directories,
We need to add "-r" option.
$ cp -r . ../myDir2
-
- Again make a copy of the source directory and its contents inside the last directory created.
$ cp -r . ../myDir2/myDir3
-
- Create a symbolic link (shortcut) of the file with the longest tree structure to the first directory with the command "ln", then delete everything with a single command without asking for confirmation
$ cd ; tree
$ ln -s myDir/myDir2/myDir3/myFile .
$ rm -r ~/*
-
- Create a text file containing a few lines without having to use an editor using the command "cat> file" use the Ctrl-C combination to terminate
$ cat > myFile
-
- Display the contents of the file using the "cat" command while numbering the files. lines.
$ cat -n myFile
-
- Display myFile page by page by concatenating the empty lines without breaking the lines long using "more"
$ more -s myFile
-
- Display your file page by page with a long prompt (display of the percentage of browsed file) by displaying special characters without filling empty lines with ~ using "less"
- First methode
$ grep '\S' jj | cat -e | less -M +Gg
- Secound methode
$ awk NF jj | cat -e | less -M +Gg