DEV Community

Shreeprabha bhat
Shreeprabha bhat

Posted on

MUST KNOW LINUX COMMANDS FOR BEGINNERS

It's common for web developers and software development aspirants to work on linux operating system. Compared to other operating systems linux is versatile and open source operating system. Understanding liux has become crucial for tech enthusiasts, system administrators and also fresh graduates who are looking forward for their career in tech market.
Let's know more about some of the most commonly used commands which are frequently asked in the interviews as well.

1. cd path/to/directory -Changes the current directory

This is the most commonly used command in the linux operating system. Whenever user want to navigate to a new folder he/she can make use of this command.
Options available:
cd .. :Comes out from the current folder
cd :Moves back to the home directory

2. ls -List files

This command is used to know about the list of files that are present in the current working folder.
Options available:
ls -l :Long listing format
ls -a :Lists hidden files

3. pwd -Present working directory

This command is used to display the current working folder.

4. mkdir directory_name -Make directory

This command is used whenever user want to create a new folder.

5. rmdir directory_name -Remove director

Above command is used whenever user wants to remove a folder that is empty.

6. rm fil_name -Removes a file

Above command is used whenever user wants to remove specific file from a directory. Along with options the command can also be used to remove directories.
Options available:
rm -r directory_name :Removes a directory along with all its files and other contents.

7. cp source_file destination_file -Copy file contents

This command is used whenever user wants to copy the contents of one file to another. Here the contents present in source_file will be copied to destination_file.
Options available:
cp -r source_directory destination_directory : Functions similar to file copying but here the entire contents of source_directory will be copied to destination_directory.

8. mv old_name new_name -Moves or renames a file

Above command is used whenever user wants to rename a file, here the file with old_name will be renamed to new_name.

9. cat file_name -Concatenate file

Using the above command user can view the contents of file_ name over the console.

10. head file_name

Using the above command user can just view the first ten lines present in the file.
Options available:
head -n 5 file_name -User can view only first five lines of file. Using this option user can vary the number of lines visible

11. tail file_name

Similar to head command here we can view the last ten lines present in the file.
Options available:
tail -n 5 file_name -To view the last five lines instead of default ten.

12. ps

Using this command one can know about the processes that are currently being run in the system. It displays the processes with their PID.

13. kill pid

We can use this command whenever we want to stop a process that is running in the system. PID required can be acquired from the ps command.

14. whoami

Using this command one can know about the user of the system.

15. uname -a

This command displays the user name along with the system information.

CONCLUSION
There are huge set of commands being used while working with linux operating systems. The commands explained here are the basic set and mainly asked in the interviews of entry level candidates.

Top comments (1)

Collapse
 
vidyarathna profile image
Vidyarathna Bhat

An excellent guide for beginners stepping into the world of Linux! It's a valuable resource for those just starting out and incredibly handy for entry-level interview preparation.