Top 20 Basic Linux Commands Every Beginner Should Know

Basic Linux Commands

What is Linux?

Linux is a powerful, open-source operating system used widely for servers, desktops, and embedded systems. Known for its stability, security, and flexibility, it supports various hardware platforms and is the foundation for many popular distributions like Ubuntu, Fedora, and CentOS.

Basic Linux Commands For Beginners

Linux is a powerful operating system that is widely used in various fields such as web servers, networking, software development, and more. Understanding basic Linux commands is crucial for navigating and managing this OS effectively. Here, we’ll explore some fundamental commands that every beginner should know.

1. pwd – Print Working Directory

The pwd command displays the current directory you are working in. This helps you keep track of your location in the file system.

$ pwd
/home/user

2. ls – List Directory Contents

The ls command lists the files and directories in the current directory. You can use various options to modify its output.

$ ls
Desktop  Documents  Downloads

3. cd – Change Directory

The cd command is used to change the current working directory.

$ cd /home/user/Documents

4. mkdir – Make Directory

The mkdir command creates a new directory.

$ mkdir new_directory

5. rmdir – Remove Directory

The rmdir command deletes an empty directory.

$ rmdir old_directory

6. rm – Remove Files and Directories

The rm command is used to remove files or directories. Be careful with this command as it permanently deletes the files.

$ rm file.txt
$ rm -r directory_name

7. touch – Create an Empty File

The touch command creates an empty file or updates the timestamp of an existing file.

$ touch newfile.txt

8. cp – Copy Files and Directories

The cp command copies files or directories from one location to another.

$ cp source_file.txt destination_file.txt
$ cp -r source_directory/ destination_directory/

9. mv – Move or Rename Files and Directories

The mv command moves files or directories to a different location or renames them.

$ mv old_name.txt new_name.txt
$ mv file.txt /new/location/

10. cat – Concatenate and Display Files

The cat command displays the content of a file.

$ cat file.txt

11. nano and vim – Text Editors

Both nano and vim are text editors used to edit files directly from the command line.

$ nano file.txt
$ vim file.txt

12. grep – Search Text Using Patterns

The grep command searches for text within files that match a given pattern.

$ grep "search_term" file.txt

13. find – Search for Files in a Directory Hierarchy

The find command searches for files and directories within a directory hierarchy.

$ find /home/user -name "filename"

14. chmod – Change File Permissions

The chmod command changes the permissions of a file or directory.

$ chmod 755 file.txt

15. chown – Change File Owner and Group

The chown command changes the owner and group of a file or directory.

$ chown user:group file.txt

16. df – Display Disk Space Usage

The df command shows the amount of disk space used and available on filesystems.

$ df -h

17. du – Display Disk Usage

The du command estimates the file space usage.

$ du -sh directory_name

18. ps – Report a Snapshot of Current Processes

The ps command displays information about active processes.

$ ps aux

19. kill – Terminate a Process

The kill command is used to terminate processes manually.

$ kill [PID]

20. sudo – Execute a Command as Another User

The sudo command allows permitted users to execute a command as the superuser or another user.

$ sudo apt-get update

Conclusion

Mastering these basic Linux commands will significantly enhance your ability to navigate and manage the Linux operating system. Whether you are a beginner or someone looking to refresh your knowledge, these commands are fundamental tools that will aid you in performing various tasks efficiently.

Share this article

Leave a Reply

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