In this article, I’ll share the most commonly used Linux shortcut commands. Below, you’ll find frequently used commands in Linux systems and their functions. These commands will help you perform operations quickly and efficiently.
1. Running Commands at a Specific Time
If you want a command to run at a specific time, you can use the at
command. This command allows you to add scheduled tasks to your system.
sudo apt install -y at
echo "halt" | at 10:20
For example, this command will run the halt
command at 10:20 AM to shut down the system.
2. Finding Files Containing Specific Words
To find files containing a specific word, you can combine the find
and grep
commands.
find . -iname "*.js" | xargs grep "js.map" -sl
This command searches for the word “js.map” within .js
files in the current directory.
3. Viewing Processes Using the Most RAM
To see which processes are using the most RAM in Linux, you can use the ps
command and sort the output.
ps aux --sort=-%mem | head
This command lists the processes that consume the most memory.
4. Killing All Processes of a User
To terminate all processes belonging to a specific user, you can use the killall
command.
killall -u ecu
This command terminates all processes belonging to the user ecu
.
5. Listing Files Between 50 MB and 1 GB
To list files within specific size ranges, you can use the find
command.
find / -type f -size +50M -size -1G
This command lists files that are between 50 MB and 1 GB in size.
6. Finding Differences Between Files/Directories
To see differences between two files or directories, you can use the diff
command.
For directory comparison:
diff -rq /home/ecu/site1 /home/ecu/site1_ydk
For line-by-line file comparison:
diff -c file1.txt file2.txt
Best Practices and Safety Tips
Using the terminal effectively increases system administrators’ productivity and allows you to take full advantage of Linux’s powerful features. By using commands correctly and carefully, you can make managing your Linux system much more efficient.
Important Reminders:
- Always ensure you’re working with the correct files and directories before trying any command
- I recommend performing careful tests in a safe environment first
- Make backups of important data before running potentially destructive commands
- Use
man
command to read documentation:man [command_name]
Conclusion
These essential Linux commands will significantly improve your workflow as a system administrator. Mastering these shortcuts will help you navigate and manage Linux systems more efficiently. Remember to always exercise caution when using powerful commands, especially those that can modify or delete system files.
These commands are essential tools for any Linux system administrator. Practice them in a safe environment to become proficient in Linux system management.