Basic Linux Commands
What is Linux?
Linux is an Operating System Kernel. Linux is free and open-source. A few of them are: Ubuntu, Linux Mint, Red Hat, Fedora ...
Almost all of the Internet is powered by Linux Servers, because Linux is secure, fast, and free. And the OS that runs in about 85% of the smartphones is also made from the Linux.
Linux commands
Terminal - is a program that receives commands from the user.
We can open it pressing Ctrl+Alt+T in Ubuntu.
Basic Commands
pwd
This command is to know which directory are you in.
When you open the terminal, you are in the home directory of your user.
ls
To know what files are in that directory. You can see all the hidden files by using the command: ls -a.
cd
Is the command used to go to a directory. Example: cd /<path.>/<folder_name_path>
mkdir
Create a folder or a directory. Example: mkdir /<path.>/<folder_name>
rmdir
Delete emply folder. Example: rmdir /path./<folder_name>
rm
rm delete files
rm -r deletes folder and the files in it
touch
Command used to create any file: txt, zip ... Example: touch file_name.zip
man
Command used to learn more about a command and how to use it. Example: man cd
help
It show which ways the command can be used. Example: cd -help
cp
Command used to copy files from a location to another. Example: cp /file_location/file_existing.txt /new_destination_file
mv
Command used to move files from a location to another. Example: mv /file_location/file_existing.txt /new_destination_file
locate –i
Command used to locate a file, when you don’t know where a file is saved. -i command is to ignore CapsLock. Example: locate –i new_file.txt
cat
Command used to display the contents of a file, used to view programs. Example: cat file_existing.txt
nano; vi
Nano and vi are already installed text editors. Both are good text editors. Example: nano file_existing.txt or vi file_existing.txt
sudo
SuperUser Do. Put sudo before any commad line if you want that command to be done with administrative or root privileges.
df
Command used to see the available disk space of the partitions.
du
Command to know the disk usage of a file or folder. Example: du Dowloads
tar
Used to compress and uncompress different types of tar archives: .tar; .tar.gz; .tar.bz2 ...
tar -cvf archive.tar/ - for creating a .tar archive
tar -xvf archive.tar - to extract a .tar archive
tar -tvf archive.tar - to list archive content
zip; unzip
zip command used to compress files into zip
unzip extract files from a zip archive.
uname
Command uname -a shows most of the information about your system
apt-get
Command used to install packages. It requires root privileges, so we use the sudo command with it. Example: sudo apt-get install package_name.
Update each time you try to install a new package: sudo apt-get update.
You can upgrade the system by typing sudo apt-get upgrade.
chmod
Command to make a file executable and to change the permissions to it.
Example: sudo chmod +x file_name - for root permisions.
hostname
hostname - show your hostname.
hostname -i - show your IP address.
clear
clear - clears your terminal.
Other usefull commands for terminal:
Press Ctrl+C to stop any command in terminal or Ctrl+Z - to force stop any commands
Type exit to quit the terminal.
Type sudo halt to power off computer.
Type sudo reboot to reboot off computer.
Hope that my informations are usefull for you.
If you like it please:
Follow - UpVote - Comment
Thank you !