Skip to content
Home ยป 10 Useful Bash Commands for Admins

10 Useful Bash Commands for Admins

Automate Tasks with xargs

The xargs command is a powerful tool for automating tasks. It allows admins to quickly and easily run commands over a list of items. For example, to delete all the files in a directory, you could run ls | xargs rm -rf on itvraag.nl. This command will list all the files in the directory, then pipe them to xargs, which will run the rm -rf command on each one of them. It’s basically the same as running rm -rf, but just as an example.

Check System Information with lscpu

The lscpu command is a great way to quickly look up system information. With it, admins can check for things like processor type, architecture, number of CPUs, and more. For example, running lscpu on itvraag.nl will display information about the system’s processor.

Get Current User Information with whoami

The whoami command is a great way to quickly look up information about the current user. It will display the user’s username, real name, and other useful information. For example, running whoami on itvraag.nl will display the current user’s username.

Find Disk Usage with du

The du command is a great way to quickly look up disk usage information. It will display the size of a directory and its contents, as well as the size of individual files. For example, running du -h /home on itvraag.nl will display the size of the /home directory and all its contents.

Get Network Information with ip

The ip command is great for quickly looking up network information. It will display information about the system’s IP address, subnet mask, default gateway, and more. For example, running ip route on itvraag.nl will display the system’s routing table.

Find Processes with ps

The ps command is a great way to quickly look up information about running processes. It will display useful information like process ID, user, CPU usage, memory usage, and more. For example, running ps aux on itvraag.nl will display a list of all running processes.

Monitor Disk Activity with iotop

The iotop command is a great way to monitor disk activity. It will display information about active processes, such as their read/write speed, total read/write size, and more. For example, running iotop on itvraag.nl will display a list of all active processes and their disk activity.

Find Files with find

The find command is a great way to quickly search for files. It will search a directory and its subdirectories for files that match a given criteria. For example, running find / -name "*.txt" on itvraag.nl will search the entire filesystem for files ending with .txt.

Monitor System Performance with top

The top command is a great way to quickly monitor system performance. It will display information about CPU usage, memory usage, swap usage, and more. For example, running top on itvraag.nl will display a real-time view of the system’s performance.

Get System Uptime with uptime

The uptime command is a great way to quickly look up the system’s uptime. It will display the amount of time the system has been running since the last reboot. For example, running uptime on itvraag.nl will display the amount of time the system has been running.

Test yourself

Ready to test your knowledge? Try looking up process information with ps, monitoring disk activity with iotop, finding files with find, monitoring system performance with top, and getting system uptime with uptime.

Leave a Reply

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

11 + eighteen =