Shell
Contents
Learn a shell a day, master Unix one day!
Pipe
Process read previous process’s output as its input and generate output to next process’s input.
Use symbol |
to create a pipeline, which a powerful skill in Unix.
|
|
Xargs
Many programs, takes its arguments from the command line (char *argv[]
) but ignores standard input fd 0
. If you want to pipe the output of a program to input of another program that ignores standard input, like rm
, you need to use xargs
.
xargs - build and execute command lines from standard input
|
|
Top
top - display Linux processes
|
|
As a default, percentages for these individual categories are displayed. Where two labels are shown below, those for more recent kernel versions are shown first.
|
|
Use man top
to check out more infomation.
Strace
strace - trace system calls and signals
In the simplest case strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments and its return value are printed on standard error or to the file specified with the -o option.
Nohup
nohup - run a command immune to hangups, with output to a non-tty
Ps
ps - report a snapshot of the current processes
Grep
grep, egrep, fgrep, rgrep - print lines that match patterns
Netstat
netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
By default, netstat displays a list of open sockets. If you don’t specify any address families, then the active sockets of all configured address families will be printed.
This program is mostly obsolete. Replacement for netstat is ss. Replacement for netstat -r is ip route. Replacement for netstat -i is ip -s link. Replacement for netstat -g is ip maddr.
[–tcp|-t] [–udp|-u] [–listening|-l] [–all|-a] [–numberic|n]
|
|
Ss
ss - another utility to investigate sockets
|
|
Ip
ip - show / manipulate routing, network devices, interfaces and tunnels
|
|
Proc
proc - process information pseudo-filesystem
The proc filesystem is a pseudo-filesystem which provides an interface to kernel data structures. It is commonly mounted at /proc/[pid]
Awk
mawk - pattern scanning and text processing language
mawk
is an interpreter for the AWK Programming Language.
|
|
Sed
sed - stream editor for filtering and transforming text
sed [OPTION]… {script-only-if-no-other-script} [input-file]…
|
|
Some tasks can be solved by using combination of a few shell.
Reference
Author Paisen
LastMod 2018-05-18