9 basic commands that every new Linux users need to know
Whenever thinking about Linux, most of people thinks Linux is only for computer programmers as it only works with commands. However it is not true. There are many modern Linux distributions are available where you don't even need to open Terminal once. You can do any everyday task with graphical interface without using any commands.
However with command line interface, you can just type commands to tell the computer what to do. That is faster and more powerful way to work with Linux systems.
While working with Linux system, it is sometimes fun to use command line interface. Whether you are new Linux users or normal Linux users, you have to know these basic commands to use maximux use of your system.
This article will lead to you know about 10 basic command that will help you to better understand your system and applications. These Linux commands are common and applies all distributions of Linux.
ls
ls
is the first command that everyone starting to use. ls
command simply prints list files and folders in the the current directory. If you want to see files and folders in the another folder, then type ls
and then type directory path. For example, below command will output files and folders in Downloads folder.
ls ~/Downloads
ls
command used with different arguments, here are some list.
If you want see files and folder in list with permission details, then use -l
argument.
ls -l
-a
option will also include hiddent files and folders also.
ls -la
pwd
pwd
command simply prints current working directory with path from root. For example, If you are in Downloads folder, then pwd will prints /home/user/Downloads
path.
cd
cd
command simply used to change your current directory. You can either move with absolute path from the root or relative path from the current folder. For example cd ..
will move to one folder up from the current folder. Use cd
command without path to move home folder. Press TAB
button to autocomplete the folder name.
mv
mv
command used to move the file to another location or rename.
For exmple, if you want to move and raname ~/Downloads/photo.jpg
to ~/Pictures
folder, then use below command. This command will move and rename also.
mv ~/Downloads/photo.jpg ~/Pictures/new-photo.jpg
cp
cp command is used to copy the file from one folder to anaother folder. For example, below command will copy photo.jpg file from current directory to ~/Pictures
folder.
cp photo.jpg ~/Pictures
rm
Use rm
command to remove file or folder. There are argument need to remove files and folder in specific case. For example, use -f
command to remove files forcefully.
rm -f Photo.jpg
-r
will also allow to remove directory with its content.
rm -rf ~/Downlads/files
mkdir
mkdir
command will create directory in the current directory. Pass directory path to create directory at different location. Use bellow command to create directory at ~/Pictures
location.
mkdir ~/Pictures/new
touch
touch
command will simply create blank file. For example, below command will create index.html
file in /var/www/html
folder.
touch /var/www/html/index.html
man
man
command is manual for other command. It will give all the details and arguments for command. Run man touch
command to see what touch
command will do and which arguments are available to use. Press q
button after you have finished reading the manual.
sudo
sudo
command is needed whenever root user permission required. sudo
command is prefixed with other command that requires root permission. Installing software or working with system directory, you need to grant sudo permission. Use this command carefully as it will also modify in the system. For example, below command will change password for current user.
sudo passwd username
If you want to change to root user in command line, then use below command. It will change to root user mode.
sudo su
Finally you are ready to use Terminal. In this article, you have learned basic commands that need for day to day use. In the next article, we will go deep and discuss about more commands.
Copyright 2023 HackTheStuff