Here is a table summarizing the essential Linux commands for daily use:
Command | Syntax | Example | Description | Practical Tips |
---|---|---|---|---|
ls | ls [options] [directory] | ls -l /home/user | Lists files and directories. | Use ls -a to include hidden files. |
cd | cd [directory] | cd /home/user/Documents | Changes the current directory. | Use cd .. to go up one directory level. |
pwd | pwd | pwd | Displays the current directory path. | Useful for checking your location in the file system. |
cp | cp [options] source destination | cp file1.txt /home/user/Documents/ | Copies files or directories. | Use -r for copying directories recursively. |
mv | mv [options] source destination | mv oldfile.txt newfile.txt | Moves or renames files or directories. | Use mv file1.txt folder/ to move a file. |
rm | rm [options] file | rm file.txt | Deletes files or directories. | Use -r to delete directories and -f to force deletion. |
touch | touch [file] | touch newfile.txt | Creates an empty file or updates file timestamp. | Handy for creating placeholder files. |
cat | cat [file] | cat file.txt | Displays the content of a file. | Combine multiple files: cat file1.txt file2.txt . |
echo | echo [string] | echo "Hello, World!" | Prints a string or variable to the screen. | Redirect output to a file with >> or > . |
grep | grep [options] pattern [file] | grep "error" log.txt | Searches for a pattern in a file. | Use -i for case-insensitive search. |
find | find [directory] [options] [expression] | find /home/user -name "*.txt" | Finds files or directories based on criteria. | Use -type f for files and -type d for directories. |
chmod | chmod [permissions] [file] | chmod 755 script.sh | Changes file permissions. | Use symbolic notation (e.g., u+x to add execute permission). |
chown | chown [owner]:[group] [file] | chown user:group file.txt | Changes file owner and group. | Use -R for recursive changes. |
ps | ps [options] | ps aux | Displays running processes. | Use top for a real-time, interactive view. |
kill | kill [pid] | kill 1234 | Terminates a process. | Use kill -9 for forceful termination. |
df | df [options] | df -h | Displays disk space usage. | Use df -T to show file system type. |
du | du [options] [directory] | du -sh /home/user | Estimates file space usage. | Use du -a to include all files. |
tar | tar [options] archive_name.tar files | tar -cvf archive.tar /home/user/docs | Creates compressed archives of files. | Use -x to extract and -z for gzip compression. |
wget | wget [options] [URL] | wget https://example.com/file.tar.gz | Downloads files from the internet. | Use -c to resume an interrupted download. |
man | man [command] | man ls | Displays the manual for a command. | Use q to quit the manual viewer. |
This table covers the most commonly used Linux commands for daily tasks and their practical tips for effective usage.