Basic Commands

While performing a task, we all need shortcuts. Shortcuts help us to complete a task quickly. Linux comes with such commands which are one to two words, using that commands, you can perform several operations in no time.

As a beginner, you must be aware of those basic Linux commands to complete an operation in a short time in the Linux-based operating system.

Basic Commands

Use of Linux Commands

Linux commands are a type of Unix command or shell procedure. They are the basic tools used to interact with Linux on an individual level.

Linux commands are used to perform a variety of tasks, including displaying information about files and directories.

Basic Commands

  1. ls command

ls   // Displays information about files in the current directory.

The ls command is commonly used to identify the files and directories in the working directory.

There is a lot of flexibility offered by this command in terms of displaying data in the output.

  1. pwd command

pwd   // Displays the current working directory.
Ex: pwd >> o/p = home/ubuntu

The pwd command is mostly used to print the current working directory on your terminal.

Now, your terminal prompt should usually include the entire directory. If it doesn’t, this is a quick command to see which directory you’re in.

  1. cd command

cd   // To navigate between different folders.
Ex: cd file

The cd command is used to navigate between directories.

It requires either the full path or the directory name, depending on your current working directory.

  1. mkdir command

mkdir // Creates a directory.
Ex: mkdir file

This mkdir command allows you to create fresh directories in the terminal itself. The default syntax is mkdir <directory name> and the new directory will be created.

  1. rmdir command

rmdir // Removes empty directories from the directory lists.
Ex: rmdir file

The rmdir command is used to delete permanently an empty directory. To perform this command the user running this command must be having sudo privileges in the parent directory.

  1. touch command

touch   // Create empty files.
Ex: touch file.txt

The touch command creates an empty file when put in the terminal in this format as touch <file name> .

  1. rm command

rm   // Delete files.
Ex: rm file.txt

rm command in Linux is generally used to delete the files created in the directory.

You can see as we wrote the ls command to view the files in the terminal and then rm <file name> to delete the files and again we had the ls command to check the update.

  1. echo command

echo // Print on the terminal.
Ex: echo "Hello DevOps Engineer"

echo command in Linux is specially used to print something in the terminal

  1. man command

man // Access manual for all Linux commands
Ex: man ls

The man command displays a user manual for any commands or utilities available in the Terminal, including their name, description, and options.

  1. cat command

cat // Display file contents on terminal.
Ex: cat file.txt

The cat command is the simplest command to use when you want to see the contents of a particular file.

The only issue is that it simply unloads the entire file to your terminal. If you want to navigate around a huge file, should use less command alternatively.

Last updated