Linux Commands
Linux Commands
1. pwd
pwd stands for Print Work directory and does exactly what you think – it shows
the directory you’re currently in. This is one of the handiest Linux terminal
commands that aims to make new user’s life peaceful by ensuring they don’t get
lost in that seemingly cryptic terminal window.
2. ls
The ls command is probably one of the most widely used commands. It presents
to you the contents of a particular directory – both files and directories.
3. cd
Short for Change Directory, the cd command is behind your movement from one
directory to another.
4. mkdir
Want to create a new folder through the terminal? The mkdir command is created
for just this specific purpose. It lets you create folders anywhere you like in your
Linux system – given you have got the necessary permission, of course!
• mkdir dirname
5. rmdir
rmdir command allows you to delete specific folders from your system without
any hassles.
• rmdir dirname
6. chmod
The chmod command is among the most powerful Linux commands you will use
to change or modify the access permissions of system files or objects. This
command can take a very diverse set of parameters from users and, based on
those changes, the file permission.
7. cat
Designed initially for concatenating multiple files, the cat command is used for
numerous other purposes since. This is among other Linux commands you will
use to create new files, view file contents in the terminal, and redirect output to
another command-line tool or file.
➢ Create new text file (*Ctrl+D to save and exit file): cat > newfile.txt
➢ Display text file on screen, read text file: cat filename, cat /path/to/file
➢ Modify file - to append (add data to existing) data to a file test.txt: cat >>
test.txt
8. cp
The cp command is just a short way of telling your machine to copy a file or
directory from one folder to another. It is among other de-facto Linux commands
you can’t live without.
9. mv
Short for a move, just like cp, you can use the mv command to move either
single or multiple files from one location to another.
10. rm
rm stands for 'remove' as the name suggests rm command is used to delete or remove
files and directory in UNIX like operating system. If you are new to Linux then you
should be very careful while running rm command because once you delete the files
then you can not recover the contents of files and directory:
▪ rm filename.txt OR
▪ rm filename1.tx filename2.txt
11. grep
Grep command is among the most powerful regular expression terminal
commands you can use when searching for patterns inside large volumes of text
files. It will take the pattern you’re looking for as input and search the specified
files for that particular pattern.
Grep pattern file(s) = globally search for a regular expression and print all lines
containing it
12. head
The head command allows you to view the beginning of a file or piped data
directly from the terminal. It’s one of the most widely used Linux commands by
users who works heavily with text processing. Use this command whenever you
are going through a lot of files in the terminal to increase your productivity.
13. tail
A compliment to the previous command, chances are you will use the tail
command much more than the header commands: