Linux Basic Commands

Commands/Future Techno India

1. pwd command

Displays the current directory. Depending on whether your Linux command line displays this information, this can be convenient for you. A script for getting the directory reference will need to execute this command in Bash programming.

2. cd command

Using the cd command, you can navigate Linux files and directories. If you’re in a working directory, either the full path or the name of the directory is required.

3. ls command

Viewing a directory’s contents with ls is possible. The contents of the current working directory will be displayed by default when you run this command.

4. cat command

A frequently used command in Linux is cat (short for concatenate). The standard output (sdout) is used to display the contents of a file. You must type cat followed by the file’s name and extension to run this command. For example cat file.txt.

  • cat > filename creates a new file

5. cp command

You can copy files from one directory to another with the cp command. For example, the command cp file1 /root/Download would file1 (from your current directory) into the Download directory.

6. mv command

Rename or move files and directories. It is noteworthy that the procedure is the same in Linux. A file is renamed when it is moved to a new folder with the same name.

7. mkdir command

Make new directories. With -p (Parents), you can create the whole structure of subdirectories, even if they do not exist, with one command.

8. rmdir command

Use the rmdir command to remove a directory. Rmdir, however, only allows you to delete empty directories.

9. rm command

A directory and its contents can be deleted using the rm command. You can also use rm -r to delete a directory instead of rmdir.

10. touch command

Through the Linux command line, you can create a blank new file using the touch command. Touch blanck_file to create an empty file entitled under the home directory.

11. grep command

A useful command for everyday use is undoubtedly grep, since it is a basic Linux command. A file can be searched through all the text contained therein.

12. wc

Linux command-line utility that counts the number of characters, bytes, and words.

13. sudo / su

Both sudo and su are ways to run a program on behalf of another user. Most likely, you use one of the two, depending on your distribution. Both work, however. Su switches you to another user, whereas sudo only executes commands on its behalf. It is, therefore, safest to use sudo.

14. df command

To see how much disk space the system is using, use the df command. For megabytes, type df -m.

15. du command

The du (Disk Usage) command shows how much space a file or directory takes up. Instead of the usual size format, the disk usage summary displays disk block numbers. By adding the -h argument to the command line, you can see the size in bytes, kilobytes, and megabytes.

16. head command

You can view the first lines of any text file using the head command. If you prefer, you can change the number of lines it shows to your liking. If you want to see only the first five lines, type head -n 5 filename.

17. tail command

The tail command has a similar function to the head command, but instead of showing the first ten lines of a text file, it will show the last ten lines. For eTail -n filename.ext, for example.

18. diff command

By comparing two files line by line, the diff command compares their contents. It will then output the duplicate lines after analyzing the files. The program has been rewritten rather than rewritten by a programmer.

19. chmod command

Linux’s chmod command changes the read, write, and execute permissions of files and directories.

20. chown command

Many users can be supported by Linux. Due to this, it must keep a careful record of who has access to a file and how they can access it. Permissions control access to resources.

21. useradd, userdel command

Linux is a multi-user operating system, so multiple people can operate it concurrently. Passwd is used to add a password to a user’s account, while useradd creates a new user. Type useradd John and then type passwd 123456789 to add John as a new user.

22. ps command

This utility displays or displays information regarding the running processes on your Linux system using the ps command, which is short for Process Status. A multi-processing and multitasking system is Linux, as we all know. Therefore, multiple processes can run simultaneously without interfering with each other

23. kill command

A kill command sends a signal to a process on Linux-like operating systems. In the absence of a signal specification, TERM will be sent by default, terminating the process.

24. uname command

By running uname, or Unix Name, you can find out what your Linux system’s name, operating system, kernel, and CPU type is.

25. sleep command

Dummy jobs are created by using the sleep command. Delaying the execution of a dummy job is helpful. By default, the time is listed in seconds, but you can change it in any format you want by adding a small suffix (s, m, h, d). The NUMBER command pauses the execution for a given amount of time.

26. wget command

With the wget command, you can even download files from the internet using the Linux command line. You can do this by typing wget followed by the download link.

27. whatis command

The whatis command in Linux displays a one-line description of a manual page. There is a description on every manual page in Linux. The command searches for manual pages names and displays their descriptions when a filename or argument is specified

28. whereis command

In Linux, the whereis command locates a command’s binary, source, and manual page files. It searches a set of restricted directories for files (binary files directories, man pages directories, and library directories).

29. ip/ifconfig command

Ip addresses are assigned to network interfaces and/or network interface parameters are configured on Linux systems by using the IP command. On modern Linux distributions, this replaces the old and now deprecated ifconfig command.

30. man command

Are you unsure of how certain Linux commands work? Using the man command in the Linux shell is a great way to learn how to use them. The man tail command, for example, will display the manual instructions.

31. history command

As soon as you’ve used Linux for a while, you’ll realize you’re capable of running hundreds of commands on a daily basis. This way, you can review commands you have previously entered by running history command.

32. ping command

To check if you’re connected to a server, use the ping command. The ping command, for example, measures the response time and whether you’re able to reach Google.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store