We have seen in a few articles how to start with the terminal and use a number of simple commands under Linux.
How to open the Linux terminal
You can quickly open a terminal simply by pressing the CTRL + ALT + T keys simultaneously or by going to the main menu of your distribution.
How to get help on Linux commands
Small reminder, commands are often followed by a number of settings and retaining them would be a feat.
By simply typing a command followed by –help, you can obtain a minimum of information for its use.
Example: passwd –help
The second way to ask for help in the terminal is to type the command man followed by the desired command.
Example: man passwd (q to quit)
The third way is of course to type the command in a search engine from your internet browser.
Some commands only respond with administrator rights. ( Su – sudo )
In order to quickly find the right command according to the situation encountered, here is a summary of the commands that seem to me most used for beginners.
First useful command, clear , to clear everything in the terminal .
Directories and Files in Linux
At what place I find myself in the directory tree: pwd
– How to get around in a directory: cd
– How to go up a directory: cd ..
– How do I go directly into a directory and subdirectory cd / Xxxx / xxxx
– How to go back to my personal folder cd ~
– How to know what is in a directory: ls (See options available with ls –help)
– How to rename a file: mv myfile newfile
– How to rename a file Directory: mv myreference directoryremove directory
– How to move a file to another directory:Mv myfile / xxxx / xxxx
– How to create a directory: mkdir unrepertoire
– How to delete a directory if empty: rmdir cirepertoire
Editing files In Linux
– How to display the contents of a file: cat myfile
– How to view the contents of a file and move the file: more myfile
– How to view a large file and go through it with the [next page]: less myfile ( Q quit
– How to display only a few lines of a file: tail -n myfile
– How to edit or modify a file: vi myfile (: q quit)
– How to easily edit or modify a file: nano myfile (CTRL X quit)
– How to edit or modify a file with gedit: gedit myfile (graphic version)
– How to compress a file with gzip:gzip myfile
– How to decompress a file with gzip: gunzip monfichier.gz
– How to extract files from an archive: tar xvf monarchive.tar
– How to extract archived and compressed files: tar xvf monarchive.tar.gz
– How to archive files : Tar cvf monarchive.tar lefichier1 lefichier2
– How to archive and compress everything in a folder: tar cvfz monarchive.tar lrepertoireTar xvf monarchive.tar.gz – How to archive files: tar cvf monarchive.tar lefichier1 lefichier2 – How to archive and compress everything in a folder: tar cvfz monarchive.tar lrepertoireTar xvf monarchive.tar.gz – How to archive files: tar cvf monarchive.tar lefichier1 lefichier2 – How to archive and compress everything in a folder: tar cvfz monarchive.tar lrepertoire
File rights
– How to view rights to files: ls -l (drwxr-xr-x)
– How to change the permissions on a chmod file (on which, + – permissions) thefile
Example:
chmod u + x install.sh This file for the owner)
chmod aw myfile (removes write permissions on this file for everyone)
chmod or myfile (removes the rights to read to others on this file)
– How to change the permissions on the entire directory and subdirectory : Chmod -R (options) directory
– How to modify the owner of a file:Chown moi monfichier
– How to modify the owner of a directory and subdirectory: chown -R (user) directory
Install software, applications, packages
Distribution based on Debian
– How to install a package (application, software): apt-get install lepaquet.deb
– How to uninstall a package (application, software): apt-get remove lepaquet.deb
Distribution based on RedHat
– How to install a package (application, software): rpm -i lepaquet.rpm or yum install lepaquet
– How to uninstall a package (application, software): rpm -e lepaquet.rpm or yum remove lepaquet
Distribution based on Arch
– How to install a package (application, software): pacman -S lepaquet
– How to uninstall a package (application, software): pacman -R lepaquet
Your system
– How to view the current processes with details: ps aux
– How to view processes and consumption by each: top (q quit)
– How to display my computer name: uname -a
– How to view kernel version: uname -r
– How to display information about its processor: cat / proc / cpuinfo
– How to display free memory: free -m or free -mt
How to identify your video card: lspci |
Grep -i vga – How to determine the available space of its disk or its disks: df -h
– How to display with which user the current session is open:
The network
– How to determine the model of its WIFI card: lspci |
Grep -i network – How to view configuration of network interfaces: ifconfig
– How to know the configuration of its wifi card: iwconfig
Type exit to exit the terminal or click on the cross to close the window.