Command-Line Tools

Check disk usage

Price range: €13.04 through €16.40

Command:

bash
du -sh /path/to/directory

Explanation:

  • du: The command used to estimate file space usage.
  • -s: Summarizes the total disk usage of the specified directory, rather than listing the usage for each individual file and subdirectory.
  • -h: Human-readable format, which converts the output into a more readable form (e.g., KB, MB, GB).
  • /path/to/directory: Replace this with the actual path of the directory you want to check (e.g., /home/user/var/log).

Result:

This command will display the total disk usage of the specified directory in a human-readable format. For example, the output might look like this:

bash
1.2G /home/user

This indicates that the /home/user directory is using 1.2 gigabytes of disk space.


Additional Notes:

  • To view the disk usage of all subdirectories within the specified directory, you can omit the -s option:
    bash
    du -h /path/to/directory
  • To sort the output by size, you can pipe the output to the sort command:
    bash
    du -sh /path/to/directory/* | sort -h
Select options This product has multiple variants. The options may be chosen on the product page

List active processes

Price range: €11.06 through €15.30

Command:

bash
ps aux

Explanation:

  • ps: The command used to display information about running processes.
  • a: Displays processes for all users.
  • u: Displays the user-oriented format, which includes the user who owns the process and other useful information.
  • x: Shows processes that are not attached to a terminal (background processes).

Result:

This command will output a list of all running processes, showing information such as:

  • Process ID (PID)
  • User
  • CPU usage
  • Memory usage
  • Start time
  • Command being executed

Alternative Command: top

To display a dynamic, real-time view of active processes, you can use:

bash
top

This will show a continuously updating list of processes, with the option to sort and filter based on various parameters (e.g., CPU usage, memory usage).


Example Output:

bash
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.2 0.1 169992 5264 ? Ss 09:00 0:05 /sbin/init
user 1423 1.5 2.3 359240 31560 ? S 10:15 0:12 /usr/bin/python3
Select options This product has multiple variants. The options may be chosen on the product page