Title: Introduction to Linux Commands.
Objective: Learn to command Linux in Linux terminal.
Theory: Linux is a community of open-source Unix like operating systems that are based on
the Linux Kernel. It was initially released by Linus Torvalds on September 17, 1991. It is a free
and opensource operating system and the source code can be modified and distributed to
anyone commercially or noncommercially under the GNU General Public License. Initially, Linux
was created for personal computers and gradually it was used in other machines like servers,
mainframe computers, supercomputers, etc. Nowadays, Linux is also used in embedded
systems like routers, automation controls, televisions, digital video recorders, video game
consoles, smartwatches, etc.
Following are some basic Linux Commands:
1. pwd command:
Use the pwd command to find out the path of the current working directory.
Syntax: pwd
2. cd command:
To navigate through the Linux files and directories, use the cd command. It requires
either the full path or the name of the directory, depending on the current working
directory that you’re in.
Syntax: cd filename/
3. ls command:
The ls command is used to view the contents of a directory. By default, this command
will display the contents of your current working directory. If you want to see the
content of other directories, type ls and then the directory’s path.
For example, enter ls /home/username/Documents to view the content of Documents.
Syntax:
ls -R will list all the files in the sub-directories as well
ls -a will show the hidden files
ls -al will list the files and directories with detailed information like the permissions, size,
owner, etc.
4. cat command
cat (short for concatenate) is one of the most frequently used commands in Linux. It is
used to list the contents of a file on the standard output (sdout). To run this command,
type cat followed by the file’s name and its extension.
Syntax: Cat > filename.txt
5. cp command
Use the cp command to copy files from the current directory to a different directory.
Syntax: cp file.txt /home/username/Documents.
6. mv command
The primary use of the mv command is to move files, although it can also be used to
rename files. The arguments in mv are similar to the cp command. You need to type mv,
the file’s name, and the destination’s directory.
Syntax: mv junu.txt /home/username/Documents.
7. mkdir command
Use mkdir command to make a new directory — if you type mkdir Movie it will create a
directory called Movie.
Syntax: mkdir Movie
8. rm command
The rm command is used to delete directories or files.
Syntax: rm filename
9. touch command
The touch command allows you to create a blank new file through the Linux command
line. Syntax: touch filename.txt
10. ping command
Use the ping command to check your connectivity status to a server.
Syntax: ping google.com
11. history command
When you’ve been using Linux for a certain period of time, you’ll quickly notice that you
can run hundreds of commands every day. As such, running history command is
particularly useful if you want to review the commands you’ve entered before.
Syntax: history
12. sudo command
Short for “SuperUser Do”, this command enables you to perform tasks that require
administrative or root permissions.
Syntax: sudo apt install neofetch
13. Alias Command
The command Alias is an amazing way to personalize and organize all your commands. It
allows users to designate a name to a single command or even a string of commands. So
programmers can give a short name before executing it.
Syntax: alias cls=clear
14. Clear
It is used to clear terminal screen.
Syntax: clear
Conclusion:
Hence we learned basic Linux commands using Linux terminal.