Linux is a powerful operating system that is widely used in both personal and professional settings. One of the advantages of using Linux is the flexibility it offers. Linux users can customize their operating system to suit their needs by installing different software, modifying the kernel, or using the command line interface. In this article, we’ll take a look at some useful and basic Linux commands that can help you get started with the operating system.
ls – List files
The ls command is used to list the files and directories in the current working directory. It can be used with various options to modify the output.
ls -a # show hidden files ls -l # show detailed information about files ls -lh # show detailed information about files in human-readable format
cd – Change directory
The cd command is used to change the current working directory. This is useful when you want to navigate to a different directory to perform operations on files.
cd /home/user/documents # navigate to the documents directory cd .. # navigate to the parent directory cd ~ # navigate to the home directory
mkdir – Create directory
The mkdir command is used to create a new directory.
mkdir new_directory # create a new directory called new_directory
rm – Remove file
The rm command is used to remove files.
rm filename.txt # remove the file called filename.txt
rmdir – Remove directory
The rmdir command is used to remove directories.
rmdir directory_name # remove the directory called directory_name
pwd – Print working directory
The pwd command is used to print the current working directory.
pwd # print the current working directory
cat – Concatenate files
The cat command is used to display the contents of a file.
cat filename.txt # display the contents of filename.txt
cp – Copy file
The cp command is used to copy files.
cp source_file destination # copy source_file to the destination directory
mv – Move file
The mv command is used to move files.
mv source_file destination # move source_file to the destination directory
chmod – Change file permissions
The chmod command is used to change the permissions of a file.
chmod u+rwx file.txt # give the owner of the file read, write, and execute permissions
These are just some of the many useful and basic Linux commands that you can use to navigate and manipulate files and directories in Linux. Learning these commands is a great way to get started with Linux and can help you become more proficient in using the operating system. As you become more comfortable with these basic commands, you can explore more advanced commands and features of Linux to further customize your experience.