In this article lets, we discuss the top 20 basic Linux commands that everyone needs to know

What is Linux?

Linux is a free and open-source operating system based on UNIX. It was originally created by Linus Torvalds in 1991. It is released under the GNU General Public License (GPL).

  • Linux is widely used in servers, mainframes, supercomputers, and embedded systems. It is one of the most popular operating systems among developers and power users.
  • Linux is a versatile operating system and it can be used for a wide variety of tasks. It is used as a desktop operating system, a server operating system, an embedded operating system, etc.
  • Linux is a versatile operating system and it can be used for a wide variety of tasks. It is used as a desktop operating system, a server operating system, an embedded operating system, etc.
  • Linux is a multiuser operating system. This means that multiple users can use the same operating system at the same time. Each user can have their own account and their own files.
  • Linux is a multitasking operating system. This means that multiple programs can run at the same time.
  • Linux is a portable operating system. This means that it can be installed on a wide variety of hardware platforms.
  • Linux is a secure operating system. This means that it is very difficult for viruses and other malicious software

Why do experts prefer Linux?

There are many reasons why experts prefer Linux.

  1. Linux is open source, which means that anyone can view and modify the code. This makes it easy to find and fix security vulnerabilities.
  2. Linux is very customizable, which allows hackers to tailor their environment to their specific needs.
  3. Linux is very stable, which means that it is less likely to crash or be affected by malware.
  4. Linux is widely used, which means that there are many resources available to help hackers learn and use it.
  5. Linux is a CLI (Command Line Interface) Based Operating System. Which helps to control everything using commands. CLI works faster than GUI.

Top 20 Basic Linux Commands

1. Sudo

sudo is a program used to run programs with the security privileges of another user, by default the superuser.

2. mkdir – Make a Directory

mkdir is a program used to create a new folder (directory).

Syntax: mkdir [directoryname] — it will create a new empty directory.

ex:: mkdir newfolder — it will create a new directory with the name of the newfolder.

Note: mkdir new folder –it will create two folders with names of new and folder. space is used for creating multiple folders. If you want to create a single folder having space use quotes. Ex: mkdir ‘new folder’

Note 2: a comma is not working in multiple directory creation. When you are using mkdir newfolder,newfolder2,newfolder3. It will create a single folder with the name newfolder,newfolder2,newfolder3.

3. ls – List of files and folders

 ls is a Linux shell command that lists directory contents of files and directories.

Syntax: $ ls

4. cd – change a directory

cd command in Linux known as change directory command. It is used to change the current working directory.

Syntax: $ cd [directory]

  • cd .. — is used to exit from preset working directory to enter into the parent directory ex: if you are in the path of $ folder1/folder2/foder3$ when you execute cd .. it will change the working directory to $folder1/folder2$
  • cd ../ cd../ — is used to exit from two directories

cd or cd\ — helps get into home directory. If you are in any directory when you enter cd or cd\ it will get into the home directory.

5. Clear – clear the screen

It is used to clear the screen and makes t empty.

Syntax: $ clear

6. pwd : Present Working Directory

pwd prints the complete address of your present working directory.

syntax: $ pwd

7. rmdir : Remove Directory

  • rmdir is used for deleting a folder that is empty
  • rm -r for deleting a folder that is non-empty
  • rm -r *for deleting all files and folders

8. echo: Print text into the file

echo command is used to add text in file

syntax: echo “message” > [filename]

echo “hello world ” > text.txt — creating a file with a single line text inside of the test file and if any text is already inside the text file it overrides with new text.

echo “hello world” >> text.txt — it will add new line in text.txt file

Note: if you add > (single arrow) it overrides anything that exits inside the file and adds the given message. if you add >> (double arrow) it will add a new line in the same file.

9. Touch – for creating empty text files

touch command is a way to create empty files.

syntax: touch [filename]

ex: touch text1 — It will create new empty text named with text1

10. nano – It is an text file editor

nano is a text file editor which is used to create, edit the text files.

$nano testfile

  • ctrl+s is used for nano editor
  • ctrl+x to exit the file editor

11. vi – It is a text file editor

vi is a text file editor which is used to create, and edit text files.

usage: $vi testfile

  • In vi editor to edit the file, we need to use I to insert. To come out from insert mode press ESC.
  • :q is the command to quit out of vi editor.
  • :w is the command to save the contents of the editor
  • :wq is used to save and quit the editor

12. copy or cp – used to copy the files

copy or cp command is used to copy the files from one directory to another directory

Syntax: copy source destination

or

Syntax: cp source destination

  • cp -r is used to copy all files from source to destination

13. History – display history

It is used to view all previously used commands.

syntax: history

14. mv or move

it is used to move files from source to destination

syntax: move source destination

15. ps – process status

it used to check the running process in a system

syntax: ps [options]

  • ps -f –used to check front end process ( means which are currently running visible to you).
  • ps -alx –list all processes that is Running

16. kill

used to kill the running process

syntax: $kill [options]

ex: kill /PID — which kills the process based on PID no

17. sudo apt-get update

which is used to update the system tools and libraries

18.Sudo apt-get upgrade

which is used to upgrade the os version to present version latest version

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trending