Here are 25 basic Linux commands that beginners should be familiar with. These commands allow you to interact with the system, manage files, and perform various tasks on a Linux-based operating system.
1. pwd
– Print Working Directory
Shows the current directory (folder) you’re in.
pwd
2. ls
– List Directory Contents
Displays the contents of a directory.
ls
3. cd
– Change Directory
Used to navigate between directories.
cd /path/to/directory
4. mkdir
– Make Directory
Creates a new directory.
mkdir new_directory
5. rmdir
– Remove Directory
Deletes an empty directory.
rmdir directory_name
6. rm
– Remove Files
Deletes files or directories. Use -r
for directories.
rm filename
rm -r directory_name
7. touch
– Create Empty File
Creates a new empty file.
touch filename.txt
8. cp
– Copy Files or Directories
Copies files or directories from one location to another.
cp source_file destination_file
cp -r source_directory destination_directory
9. mv
– Move or Rename Files
Moves or renames files and directories.
mv old_name new_name
mv file_name /path/to/destination/
10. cat
– Concatenate Files
Displays the content of a file.
cat filename.txt
11. more
– View File Content
Displays content of a file, one screen at a time.
more filename.txt
12. less
– View File Content
Similar to more
, but allows backward navigation.
less filename.txt
13. echo
– Display a Message
Displays a message or variable value in the terminal.
echo "Hello, World!"
14. man
– Manual Pages
Shows the manual or help pages for any command.
man ls
15. chmod
– Change File Permissions
Modifies the read, write, and execute permissions of files or directories.
chmod 755 filename
16. chown
– Change File Owner
Changes the owner and group of a file.
chown user:group filename
17. ps
– Process Status
Displays a list of running processes.
ps
18. top
– Task Manager
Shows real-time information about system resources and running processes.
top
19. kill
– Terminate a Process
Used to stop a running process.
kill process_id
20. df
– Disk Space Usage
Displays the amount of disk space used and available on the file system.
df -h
21. du
– Disk Usage
Shows the disk space used by files and directories.
du -sh directory_name
22. grep
– Search Text in Files
Searches for specific patterns within files.
grep "search_term" filename.txt
23. find
– Search for Files
Searches for files and directories in a specified location.
find /path/to/search -name "file_name"
24. history
– Command History
Displays the history of commands you have entered in the terminal.
history
25. sudo
– Execute as Superuser
Allows you to execute commands with superuser (root) privileges.
sudo command_name
Conclusion
These basic Linux commands form the foundation for interacting with a Linux operating system. By practicing these commands, you’ll become more comfortable managing files, navigating directories, and performing system administration tasks in Linux.