Operating system

Published on December 13th, 2019 | by Guest

0

10 Basic Most Commonly Used Linux Commands

Nowadays, Linux is almost everywhere: from your Android smart gadgets such as smart TVs and smartphones to biometric systems and not forgetting how massively it plays a major role in the web hosting business. Most beginners find it daunting getting started with Linux given that administration is usually done on the terminal by running commands. This ought not to be the case and in this tutorial, we walk you through some of the most commonly used Linux commands.

Sudo

Short for SuperUserdo, this is one of the most quintessential commands that you will learn as a beginner? So what does sudo command do? The command grants regular Linux users administrative privileges to run commands delegated for the root user. It’s appended before the command that is to be run. For example, to update Ubuntu as a regular use simply run

$ sudo apt update

After invoking the sudo command, you will be prompted to enter your password and later hit the ENTER key for the task or command to be executed.

Note that the regular user must be granted sudo privileges to be able to successfully execute this command.

ls command

Probably one of the most frequently used commands is the ls command. Short for list, the command is used for listing the contents of a directory. It displays both files and directories.

For example:

Poweroff command

Lastly, in case you need to shut down your PC after a long and hard day, use the Linux shutdown command known as poweroff. This command needs to be executed as a root user or as a regular user with sudo privileges if you can recall the very first point in this tutorial.

$ sudo poweroff

pwd

This is short for print Work directory. It displays the path that you are currently working in and makes it easy for a user to know their way around in the terminal.

From the snap above, we can see that the user is currently in the /home/winnie path.

cp command

The cp command is used for copying files and directories from one location to another on the terminal. The syntax is quite easy:

$ cp /source/of/file/ /destination/of/file

For example, to copy a file file1.txt from Documents/data to /Downloads directory run

$ cp Documents/data/file1.txt /Downloads

To confirm the existence of the file in the destination path, simply use the ls command to list the contents of the directory.

$ ls Downloads/

cd command

The cd command, short for change directory, is used for navigating from one directory to another.

Syntax:

$ cd /path/to/directory

To navigate to /etc/ssh directory, execute the command:

$ cd /etc/ssh

mkdir command

The mkdir command (make directory) is used for creating new directories. The syntax for creating a directory is quite simple.

$ mkdir directory_name

For example, to create a directory techfiles run:

$ mkdir techfiles

rmdir command

The rmdir command does the exact opposite of mkdir command: It deletes empty directories. For example, to delete the techfiles directory, run the command:

$ rmdir techfiles

To delete a directory with contents inside such as files and folders, use the rm command with the -R option. Assuming the techfiles folder had contents as shown, you would delete it together with its contents as shown.

$ rm -R techfiles

The rm command

The rm command is used for deleting files and even directories

To delete a file use the syntax:

$ rm file_name

For example to delete file1.txt run:

$ rm file1.txt

To delete a directory use the -R option to delete the directory alongside its contents as seen in the previous subtopic.

Cat command

The cat command is used for displaying the contents of a file.

Syntax:

$ cat file_name

For example to view contents of a file file1.txt

$ cat file1.txt

Like this post? Share with your friends.
Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Share on Reddit
Reddit
0Share on Tumblr
Tumblr
0Share on VK
VK
Email this to someone
email

Tags: , ,


About the Author

Guest

Contribution of guest authors towards Techno FAQ blog



Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top ↑