DEV Community

Radurga Rajendran
Radurga Rajendran

Posted on

Basic Linux Commands

  1. pwd — When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system and is denoted by a forward slash( / ). The user directory is usually something like “/home/username”.

Image description

  1. ls — Use the “ls” command to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a”.

Image description

  1. cd — Use the “cd” command to go to a directory. “cd” expects directory name or path of new directory as input.

Image description

  1. mkdir & rmdir — Use the mkdir command when you need to create a folder or a directory.Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.

Image description

  1. rm – Use the rm command to delete a file. Use “rm -r” to recursively delete all files within a specific directory.

Image description

  1. touch — The touch command is used to create an empty file. For example, “touch new.txt”.

Image description

  1. cp — Use the cp command to copy files through the command line.

Image description

  1. mv — Use the mv command to move files through the command line. We can also use the mv command to rename a file.

Image description

9.cat — Use the cat command to display the contents of a file. It is usually used to easily view programs.

Image description

10.vi - You can create a new file or modify a file using this editor.

Image description

Top comments (0)