Docsity

Linux Command Line Reference Guide, Exams of Advanced Education

Toggle sidebar
bg1
LFCS
cat - cat - concatenate files and print on the standard output
sed - sed - stream editor for filtering and transforming text
The name sed is short for stream editor. For those unfamiliar with the term, a stream
editor is used to perform basic text transformations on an input stream (a file or input
from a pipeline).
The most basic (and popular) usage of sed is the substitution of characters.
uniq - uniq - report or omit repeated lines
The uniq command allows us to report or remove duplicate lines in a file, writing to
stdout by default.
uniq is commonly used along with a preceding sort (which is used to sort lines of text
files).
top - display Linux processes
pgrep - pgrep, pkill - look up or signal processes based on name and other attributes
ps - ps - report a snapshot of the current processes.
ps displays information about a selection of the active processes. If you want a
repetitive update of the selection and the displayed information, use 'top' instead.
nice - nice - run a program with modified scheduling priority
renice - renice - alter priority of running processes
renice alters the scheduling priority of one or more running processes. The first
argument is the priority value to be used.
Example: renice 10 1292
kill - kill - terminate a process
dpkg - dpkg - package manager for Debian
aptitude -
pf3
pf4
pf5

Partial preview of the text

Download Linux Command Line Reference Guide and more Exams Advanced Education in PDF only on Docsity!

LFCS

cat - cat - concatenate files and print on the standard output sed - sed - stream editor for filtering and transforming text The name sed is short for stream editor. For those unfamiliar with the term, a stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). The most basic (and popular) usage of sed is the substitution of characters. uniq - uniq - report or omit repeated lines The uniq command allows us to report or remove duplicate lines in a file, writing to stdout by default. uniq is commonly used along with a preceding sort (which is used to sort lines of text files). top - display Linux processes pgrep - pgrep, pkill - look up or signal processes based on name and other attributes ps - ps - report a snapshot of the current processes. ps displays information about a selection of the active processes. If you want a repetitive update of the selection and the displayed information, use 'top' instead. nice - nice - run a program with modified scheduling priority renice - renice - alter priority of running processes renice alters the scheduling priority of one or more running processes. The first argument is the priority value to be used. Example: renice 10 1292 kill - kill - terminate a process dpkg - dpkg - package manager for Debian aptitude -

apt-cache - apt-cache - query the APT cache apt-cache performs a variety of operations on APT's package cache. apt-cache does not manipulate the state of the system but does provide operations to search and generate interesting output from the package metadata. apt-get - rpm - yumdownloader - useradd -m -s /bin/bash - cp -rT /etc/skel/ - -r = recursive -T = treat dest as normal file usermod -aG - ps axjf - apt-get autoclean - yum list - yum search - yum info - yum list installed | more - yum check-update - yum grouplist | more - yum groupinstall - Yum --enablerepo= * - yum repolist - yum clean all - yum history - rpm -qpR -

cp -f - Forces copy; does not ask for verification cp -i - Interactive copy; before each file is copied, verifies with user cp -R,-r - Copies directories recursively mv -f - Forces move mv -i - Interactive move find. -atime 7 - Finds all files in the current directory that have not been accessed in at least seven days find. -name core -exec rm {} ; - Finds all files in the present working directory whose names are core and then deletes them iptables --flush - iptables-save > /etc/sysconfig/iptables - iptables-restore < /etc/sysconfig/iptables - ss -tnlp | grep 22 - systemctl start telnet.socket - chkconfig | more - rmdir - tar

iptraf - dstat - ip route show - route add -net 172.17.0.0 netmask 255.255.0.0 gw 172.16.0.1 dev eth0 - netstat -rn - ip route - sudo apt-get install quagga - ss -s - ss -l - ss -pl - ss -4 state ESTABLISHED - Allows you to filter IPv4 traffic by type - show type ESTABLISHED ss -4 state LISTEN - Allows you to filter IPv4 traffic by type - show type LISTEN dstat 5 10 - display the current processes, memory and network bandwidth utilization of the server and run every five seconds and execute only ten iterations of it before stopping dstat - display the current processes, memory and network bandwidth utilization of the server dstat -n 2 5 - display ONLY network statistics every two seconds, looping through five executions before exiting du -sch /path/to/directory/* - returns the disk space usage per subdirectories and files within the specified directory in human-readable format (also shows a total per directory), and does not order the output by size, but by subdirectory and file name du -sch /var/* | sort -h - returns the disk space usage per subdirectories and files within the specified directory in human-readable format (also shows a total per directory), and does not order the output by size, but by subdirectory and file name. Then it pipes into sort and sorts by size (-h).

What is Runlevel 3 - Redhat/SUSE Text Mode What is Runlevel 4 - Wildcard (Not used by default) What is Runlevel 5 - Redhat/SUSE GUI Mode What is Runlevel 6 - Reboot chmod g+s - Set group ID to a directory. Likely use when members of a one group that need access to all files of a directory regardless of who owns that group What is the basic syntax of the 'sed' command? - sed 's/term/replacement/flag' file Example: sed 's/y/Y/g' file.txt The g flag indicates that sed should perform the substitution for all instances of term on every line of file. If this flag is omitted, sed will replace only the first occurrence of term on each line. What is the command 'sed' short for? (definition) - The name sed is short for stream editor. For those unfamiliar with the term, a stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). What is the command 'sed' primarily utilized for? - The most basic (and popular) usage of sed is the substitution of characters.Another use of sed is showing (or deleting) a chosen portion of a file. What would happen when running 'sed' with the '-n' flag? i.e. sed -n '/^Jun 8/ p' /var/log/messages | sed -n 1,5p - By default, sed prints every line. We can override this behaviour with the -n option and then tell sed to print (indicated by p) only the part of the file (or the pipe) that matches the pattern (Jun 8 at the beginning of line in the first case and lines 1 through 5 inclusive in the second case).