DEV Community

Sivakumar
Sivakumar

Posted on

Your Guide to Basic Linux Commands Day07

xargs

xargs is a command-line utility in Unix/Linux used to build and execute command lines from standard input. It's often used to convert output from one command into arguments for another command.

It can also be used for other purposes with its switches like:

  • xargs -a = will show the contents of a file

Example:

echo f1 > file01.txt | xargs rm
xargs -a file02.txt
Enter fullscreen mode Exit fullscreen mode

runlevel

Modern Linux distros use a concept called targets from systemd. runlevel is a concept of system initialization from the sysV . This defines the mode of operation whether its in single user mode , multi user mode , etc...
The different run levels are :
0 Halt (shuts down the system)
1 Single-user mode (for maintenance)
2 Multi-user mode (no network)
3 Multi-user with networking (text mode)
4 Undefined / user-definable
5 Multi-user with GUI (graphical desktop)
6 Reboot
Example:
runlevel

init

init is the first command that will run when the system starts. It will always have the process id 01 and starts other process. This command can be used to switch between different run levels.

Example:

init 0
init6
Enter fullscreen mode Exit fullscreen mode

The "init 0" command will shutdown the system and "init 6" will reboot the system.

ps

This command will display a snapshot of the current active processes in the system.This has quite a few switches like:

  • ps -x - displays process run by the user
  • ps -ax - displays all the process using BSD syntax

Example:

ps
ps -x
Enter fullscreen mode Exit fullscreen mode

pstree

This command will display a tree structure of the processes running. It is very helpful to identify which process started others and debug.

Example:

pstree
pstree -p saber ##displays the user process
Enter fullscreen mode Exit fullscreen mode

Top comments (0)