Basic Linux commands

The Linux command is a piece of software that comes with the Linux operating system. Commands are used to perform all simple and complicated operations. The commands are executed on the Linux terminal which is a command-line interface similar to the command prompt in Windows.

Linux Commands

pwd – To know which directory you are in, using pwd will show you the absolute path which starts from the root directory.

ls – This command shows all the files and folders inside the directory you are in. Add -a to show all the files and folders including the hidden files.

cd – This command is used to change the location of your directory path. Using cd command only will redirect you to the user path which you will notice if the $ has (~) character beside it.
Note: if the folder name has space, wrap it with quotations (” “) as it reads the command in a single string

mkdir and rmdir – Use mkdir command to add new folder in the directory you are in. rmdir command is used for deleting an empty folder only.

rm – To delete a specific file in the directory, use rm <name_of_file> command. If it is a folder, use rm -R <name_of_folder>

touch – Using this command will add new file in the directory path. Running command touch <name_of_file>.<ext_name>

cp – This command is used to copy a file to another location. To copy enter command cp /path/of/file/to_be/copy /path/of/destination

mv – Use the mv command to move files through the command line, mv /path/of/file /destination/of/file. This command can also be used for renaming a file.


Leave a Comment

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