All Flashcards
DEFAULT
list the common shells
bash #The GNU Bourne Again Shell
sh #The Bourne shell upon which bash is based
tcsh #This shell is based on the earlier C shell
csh #The original C shell
ksh #The Korn shell; bourne shell+c shell+extended
zsh #The Z shell takes shell evolution further than the Korn shell
DEFAULT
what is an internal command
a command that is built into the shell program
DEFAULT
what is an external command
a command that is not built into the shell program
DEFAULT
how do you reverse search for a command in your history
ctrl+r
DEFAULT
how do you search for a command in your history
ctrl+s
DEFAULT
how do you terminate a search through your command history
ctrl+g
DEFAULT
how do you move your shell cursor to the beginning of the line
ctrl+a
DEFAULT
how do you move your shell cursor to the end of the line
ctrl+e
DEFAULT
how do you move the shell cursor back one character
Ctrl+b
DEFAULT
how do you move the shell cursor forward one character
Ctrl+f
DEFAULT
how do you delete the character under the shell cursor
Ctrl+d
DEFAULT
how do you delete all text from the shell cursor to the end of the line
ctrl+k
DEFAULT
how do you delete all of the text from the shell cursor to the beginning of the line
Ctrl+x and then Backspace
DEFAULT
how do you transpose the character before the cursor with the character under the shell cursor
ctrl+t
DEFAULT
how do you transpose the two words immediately before (or under) the shell cursor
Esc and then t
DEFAULT
how do you convert text from the shell cursor to the end of the word to uppercase.
Pressing Esc and then u
DEFAULT
how do you convert text from the cursor to the end of the word to lowercase
Esc and then l
DEFAULT
how do you convert the letter under the cursor (or the first letter of the next word) to uppercase; leaving the rest of the word unaffected.
Esc and then c
DEFAULT
how do you launch a full-fledged editor to edit a command at the shell
Ctrl+x followed by Ctrl+e
DEFAULT
how do you set an enviornment variable
VARNAME=VALUE
DEFAULT
how do you save an environment variable across sessions
export VARNAME
DEFAULT
how do you set and save an environment variable across sessions
export VARNAME=VALUE
DEFAULT
what is man section 1
Executable programs and shell commands
DEFAULT
what is man section 2
System calls provided by the kernel
DEFAULT
what is man section 3
Library calls provided by program libraries
DEFAULT
what is man section 4
Device files (usually stored in /dev )
DEFAULT
what is man section 5
File formats
DEFAULT
what is man section 6
Games
DEFAULT
what is man section 7
Miscellaneous (macro packages; conventions; and so on)
DEFAULT
what is man section 8
System administration commands (programs run mostly or exclusively by root )
DEFAULT
what is man section 9
Kernel routines
DEFAULT
what is stdin’s file descriptor
0
DEFAULT
what is stdout’s file descriptor
1
DEFAULT
what is stderr’s file descriptor
2
DEFAULT
how do you specify all numbers and letters in the tr command
[:alnum:]
DEFAULT
how do you specify all uppercase letters in the tr command
[:upper:]
DEFAULT
how do you specify all lowercase letters in the tr command
[:lower:]
DEFAULT
how do you specify all numbers in the tr command
[:digit:]
DEFAULT
how do you specify a range of characters in the tr command
You can specify a range of characters by separating them with dashes ( - ); as in A-M
DEFAULT
how do you move forward one screen in less
spacebar
DEFAULT
how do you move back one screen in less
Esc followed by v
DEFAULT
how do you do a search in less
/STRING
DEFAULT
how do you do a backward search in less
?STRING
DEFAULT
how do you move to the next search result in less
n
DEFAULT
how do you move to the previous search result in less
N
DEFAULT
how do you go to a specific line in less
gNUMBER
DEFAULT
how do you display the help system in less
h
DEFAULT
what are the extended regular express characters
? + | ( )
DEFAULT
what is the windows newline
/r/n
DEFAULT
what is the mac newline
/n
DEFAULT
what is the linux newline
/n
DEFAULT
how could you use tr to convert from windows to linux format line endings
tr -d \r < dosfile.txt > unixfile.txt
DEFAULT
how could you use sed to convert from linux to windows line endings
sed “”s/$/\r/”” unixfile.txt > dosfile.txt
DEFAULT
describe the naming convention of this rpm package: string-a.b.c-x.y.rpm
string = Package Name a.b.c = Version Number x = Build Number y = Architecture
DEFAULT
How would you use rpm to install or upgrade package samba-4.1.9-4.fc20.x86_64.rpm from an RPM file that you have already downloaded to your local system
rpm -Uvh samba-4.1.9-4.fc20.x86_64.rpm
DEFAULT
how would you query information on the installed package samba using rpm
rpm -qi samba
DEFAULT
how would you convert samba-4.1.9-4.fc20.src.rpm to samba-4.1.9-4.fc20.src.cpio
rpm2cpio samba-4.1.9-4.fc20.src.rpm > samba-4.1.9-4.fc20.src.cpio
DEFAULT
how would you extract samba-4.1.9-4.fc20.src.cpio
cpio -i –make-directories < samba-4.1.9-4.fc20.src.cpio
DEFAULT
how would you extract samba-4.1.9-4.fc20.src.rpm on a system without rpm
rpm2cpio samba-4.1.9-4.fc20.src.rpm | cpio -i –make-directories
DEFAULT
how do you install samba_4.1.6+dfsg- 1ubuntu2.1404.3_amd64.deb
dpkg -i samba_4.1.6+dfsg-1ubuntu2.1404.3_amd64.deb
DEFAULT
how do you uninstall samba using dpkg
dpkg -r samba
DEFAULT
what information is displayed by ps
username; process id; parent process id; tty; cpu time; cpu priority; memory usage; command
DEFAULT
how do you send a program to the background
ctrl+z
DEFAULT
what is process signal 1 and what does it do
SIGHUP ; which terminates interactive programs and causes many daemons to reread their configuration files
DEFAULT
what is process signal 9 and what does it do
SIGKILL ; which causes the process to exit without performing routine shutdown tasks)
DEFAULT
what is process signal 15 and what does it do
SIGTERM ; which causes the process to exit but allows it to close open files and so on
DEFAULT
what is process signal SIGHUP and what does it do
1 ; which terminates interactive programs and causes many daemons to reread their configuration files
DEFAULT
what is process signal SIGHKILL and what does it do
9 ; which causes the process to exit without performing routine shutdown tasks)
DEFAULT
what is process signal SIGHTERM and what does it do
15 ; which causes the process to exit but allows it to close open files and so on
DEFAULT
what is an interrupt request
a signal sent to the CPU instructing it to suspend its current activity and to handle some external event such as keyboard input
DEFAULT
what is IRQ 0
system timer
DEFAULT
what is IRQ 1
keyboard
DEFAULT
what is IRQ 2
handles IRQ 8-15
DEFAULT
what is IRQ 3
COM2
DEFAULT
what is IRQ 4
COM1
DEFAULT
what is IRQ 5
LPT2 / Sound card
DEFAULT
what is IRQ 6
Floppy controller
DEFAULT
what is IRQ 7
parallel port
DEFAULT
what is IRQ 8
real time clock
DEFAULT
what is IRQ 12
ps2 mouse
DEFAULT
what is IRQ 13
floating point proc
DEFAULT
what is IRQ 14
primary IDE
DEFAULT
what is IRQ 15
secondary IDE
DEFAULT
what are i/o addresses
unique locations in memory that are reserved for communications between the CPU and specific physical hardware devices
DEFAULT
what is direct memory addressing
an alternative method of communication to I/O ports. Rather than have the CPU mediate the transfer of data between a device and memory; DMA permits the device to transfer data directly; without the CPU’s attention
DEFAULT
how does the BIOS boot process begin
the computer reading a boot sector (typically the first sector) from a disk and then executing that code
DEFAULT
how does the EFI boot process begin
the computer reading a boot loader file from a filesystem on a special partition; known as the EFI System Partition (ESP) . This file either can take a special default name or can be registered in the computer’s NVRAM
DEFAULT
what is the HAL Daemon
The Hardware Abstraction Layer (HAL) Daemon ; or hald ; is a user-space program that runs at all times (that is; as a daemon) and provides other user-space programs with information about available hardware
DEFAULT
what is the D-Bus
The Desktop Bus (D-Bus) provides a further abstraction of hardware information access. Like hald ; D-Bus runs as a daemon. D-Bus enables processes to communicate with each other as well as to register to be notified of events; both by other processes and by hardware (such as the availability of a new USB device).
DEFAULT
what is mbr partition code 0x0c
fat
DEFAULT
what is mbr partition code 0x05
old extended code
DEFAULT
what is mbr partition code 0x07
ntfs
DEFAULT
what is mbr partition code 0x0f
newer extended code
DEFAULT
what is mbr partition code 0x82
linux swap
DEFAULT
what is mbr partition code 0x83
linux filesystem
DEFAULT
what is mbr partition code 0x8e
LVM
DEFAULT
what directories should never be on a seperate partition from /
/bin /dev /etc /lib /sbin
DEFAULT
describe ext2fs
traditional Linux-native filesystem; no journaling
DEFAULT
describe ext3fs
ext2 with journaling
DEFAULT
describe ext4fs
ext3 with performance and size extensions
DEFAULT
describe ReiserFS
designed from scratch as a journaling filesystem for Linux. It’s particularly good at handling large numbers of small files (
DEFAULT
describe JFS
IBM developed the Journaled File System (JFS) for its AIX OS on mainframe systems and later reimplemented it on its attempt at a workstation OS; called OS/2. After the demise of OS/2; the OS/2 version of JFS was subsequently donated to Linux
DEFAULT
describe XFS
Silicon Graphics (SGI) created its Extents File System (XFS) for its IRIX OS and; like IBM; later donated the code to Linux. Like JFS; XFS is a very technically sophisticated filesystem. XFS has gained a reputation for robustness; speed; and flexibility on IRIX; but some of the XFS features that make it so flexible on IRIX aren’t supported well under Linux.
DEFAULT
describe Btrfs
is an advanced filesystem with features inspired by those of Sun’s Zettabyte File System (ZFS).
DEFAULT
describe FAT
old and primitive—but ubiquitous. It’s the only hard disk filesystem supported by DOS and early versions of Windows (such as the Windows 9 x series and the short-lived Windows Me). For this reason; every major OS understands FAT;
DEFAULT
describe NTFS
the preferred filesystem for Windows NT and beyond. Unfortunately; Linux’s NTFS support is rather rudimentary. As of the 2.6. x kernel series; Linux can reliably read NTFS and can overwrite existing files; but the Linux kernel can’t write new files to an NTFS partition. There are separate drivers outside of the kernel that you can use in Linux to create new files on an NTFS filesystem
DEFAULT
describe HFS[+]
Apple has long used the Hierarchical File System (HFS) with its Mac OS; and Linux provides full read/write HFS support. This support isn’t as reliable as Linux’s read/write FAT support; though; so you may want to use FAT when exchanging files with Mac users.
DEFAULT
describe ISO-9660
CD-ROMs; Linux Rock Ridge extensions; Joliet Windows extensions
DEFAULT
describe UDF
Universal Disc Format (UDF) is the next-generation filesystem for optical discs. It’s commonly used on DVD-ROMs and recordable optical discs. Linux supports it; but read/write UDF support is still in its infancy.
DEFAULT
describe the /etc/fstab file format
#device mount point filesystem options dump(1 means the dump program should do a dump) fsck(fsck check order, 0 means don't check) e.g. UUID=3631a288-673e-40f5-9e96-6539fec468e9 \ /usr reiserfs defaults 0 0
DEFAULT
what does ““credentials=/etc/creds”” in the options column of the /etc/fstab signify
the login credentials(username and password) are stored in /etc/creds
DEFAULT
what characters should not be used in filenames
- ? / \ “”
DEFAULT
what are the wildcard expansion characters
? * [a-z]
DEFAULT
what are the three timestamps on each file
Last file-modification time
Last inode change time
Last access time
DEFAULT
how would you compress ∼/my-work and gzip it into /media/pen/my-work.tgz
tar cvfz /media/pen/my-work.tgz ∼/my-work
DEFAULT
what are the file type codes displayed by ls -l
- normal file
d directory
l symlink
p named pipe (A pipe enables two running Linux programs to communicate with each other. One opens the pipe for reading; and the other opens it for writing; enabling data to be transferred between the programs)
s socket (similar to a named pipe; but it permits network and bidirectional links)
b block device (a file that corresponds to a hardware device to and from which data is transferred in blocks of more than 1 byte. Disk devices (hard disks; USB flash drives; CD-ROMs; and so on))
c character device (a hardware device to and from which data is transferred in units of 1 byte. Examples include parallel port; RS-232 serial port; and audio devices)
DEFAULT
what does the directory execution bit do
When a directory’s execute bit is set; that means that the directory’s contents may be searched
DEFAULT
what does the write bit on a directory do
if a user can write to a directory; that user can create; delete; or rename files in the directory as well
use the sticky bit to alter this behavior
DEFAULT
what are the permissions of a symlink
always 777
trying to change it’s permissions will affect the file it points to
DEFAULT
how is set user id represented
4000
SUID
s in the owner’s execute bit
If the SUID bit is set on a file without execution permission set; the permission string appears with a capital S ; as in rwSr-xr-x . However; in this case; SUID will not function and the setting is called benign .
DEFAULT
how is set group id represented
2000
SGID
s in the group’s execute bit
f the SGID bit is set on a file without execution permission set; the permission string appears with a capital S ; as in rwsr-Sr-x . Also in this case the setting is benign.
SGID is also useful on directories. When the SGID bit is set on a directory; new files or subdirectories created in the original directory will inherit the group ownership of the directory rather than be based on the user’s current default group
DEFAULT
how is sticky bit represented
1000
t in the world’s execute bit
When this bit is present on a directory; the directory’s files can be deleted only by their owners; the directory’s owner; or root
DEFAULT
what is a typical default umask
002 or 022
DEFAULT
how would you set the permissions of newly created folders to have rwxrxrx permissions symbolically
umask u=rwx,g=rx,o=rx
DEFAULT
how would you add user quota support to a mount point in /etc/fstab
/dev/sdc5 /home ext4 usrquota 1 1
DEFAULT
how would you add group quota support to a mount point in /etc/fstab
/dev/sdc5 /home ext4 grpquota 1 1
DEFAULT
how would you add user and group quota support to a mount point in /etc/fstab
/dev/sdc5 /home ext4 usrquota,grpquota 1 1
DEFAULT
what is the old filesystem structure for linux called
FSSTND
Filesystem Standard
Standardized the programs that reside in
/bin and /usr/bin.
Specified that executable files shouldn’t reside in
/etc
Removed changeable files from the
/usr
enabling it to be mounted read-only (a useful security measure).
DEFAULT
what is the current filesystem structure
Filesystem Hierarchy Standard (FHS)
Shareable; Unshareable; Static; Variable
DEFAULT
what are some static shareable directories in FHS
/usr
/opt
DEFAULT
what are some static unshareable folders in FHS
/etc
/boot
DEFAULT
what are some variable shareable folders in FHS
/home
/var/mail
DEFAULT
what are some variable unshareable folders in FHS
/var/run
/var/lock
DEFAULT
what directories are recommended to have their own partition
/boot /home /opt /tmp /usr /usr/local /var
DEFAULT
how does grub legacy start a boot entry
title
DEFAULT
how does grub 2 start a boot entry
menuentry
DEFAULT
what is the system logger
syslogd
writes files to
/var/log/messages
/var/log/syslog
DEFAULT
what are the 3 popular initialization process methods used in linux
Unix System V (also called SysV)
Upstart (ubuntu; each service has a configuration file)
systemd (redhat) (this is the winner! everyone important is switching to it)
DEFAULT
describe runlevel 0
shutdown
A transitional runlevel; meaning that it’s used to shift the computer from one state to another. Specifically; it shuts down the system. On modern hardware; the computer should completely power down. If not; you’re expected to either reboot the computer manually or power it off.
DEFAULT
describe runlevel 1
also s or S
Single-user mode. What services; if any; are started at this runlevel vary by distribution. It’s typically used for low-level system maintenance that may be impaired by normal system operation; such as resizing partitions.
DEFAULT
describe runlevel 2
On Debian and its derivatives; a full multi-user mode with X running and a graphical login. Most other distributions leave this runlevel undefined.
DEFAULT
describe runlevel 3
On Fedora; Mandriva; Red Hat; and most other distributions; a full multi-user mode with a console (nongraphical) login screen.
DEFAULT
describe runlevel 4
Usually undefined by default and therefore available for customization.
DEFAULT
describe runlevel 5
On Fedora; Mandriva; Red Hat; and most other distributions; the same behavior as runlevel 3; with the addition of having X run with an XDM (graphical) login.
DEFAULT
describe runlevel 6
Used to reboot the system. This runlevel is also a transitional runlevel. Your system is completely shut down; and then the computer reboots automatically.
DEFAULT
what is a systemd unit
defines a service or action on the system
eg. mount; service; snapshot
DEFAULT
what are the systemd units
automount device mount path service snapshot socket target
COMMANDS
pwd
print the working directory
COMMANDS
echo STRING
display text from stdin
COMMANDS
time COMMAND
times how long COMMAND takes to execute
Three times are displayed: totalexecution time (aka real time); user CPU time; and system CPU time
COMMANDS
set
displays a wide variety of options relating to bash shell operation
These options are formatted much like environment variables; but they aren’t the same things. You can pass various options to set to have it affect a wide range of shell operations.
COMMANDS
exit
terminates any shell
Login shells are shell programs that are launched automatically when you initiate a text-mode login as opposed to those that run in xterm windows or other terminal emulators
COMMANDS
logout
terminates only login shells
Login shells are shell programs that are launched automatically when you initiate a text-mode login as opposed to those that run in xterm windows or other terminal emulators
COMMANDS
type COMMAND
tells you how a command you enter will be interpreted—as a built-in command; an external command; an alias; and so on
COMMANDS
history
displays all of the commands in the history
typically the latest 500 commands
COMMANDS
!!
display and execute the last command in your shell history
COMMANDS
!NUMBER
execute command NUMBER from the history
COMMANDS
$PATH
a directory list to search when you’re entering command or program names
COMMANDS
env
display environment variables
COMMANDS
unset VARNAME
unset an environment variable
COMMANDS
$PS1
the shell prompt
COMMANDS
man COMMAND
display the manual for COMMAND
COMMANDS
info COMMAND
hypertext formatted manual
COMMANDS
help COMMAND
a built in manual for built in commands
COMMANDS
>
Creates a new file containing standard output. If the specified file exists; it’s overwritten. No file descriptor necessary.
COMMANDS
|»_space;
Appends standard output to the existing file. If the specified file doesn’t exist; it’s created. No file descriptor necessary.
COMMANDS
2>
Creates a new file containing standard error. If the specified file exists; it’s overwritten. File descriptor necessary.
COMMANDS
2»
Appends standard error to the existing file. If the specified file doesn’t exist; it’s created. File descriptor necessary.
COMMANDS
&>
Creates a new file containing both standard output and standard error. If the specified file exists; it’s overwritten. No file descriptors necessary.
COMMANDS
Sends the contents of the specified file to be used as standard input. No file descriptor necessary.
COMMANDS
Accepts text on the following lines as standard input. No file descriptor necessary.
COMMANDS
<>
Causes the specified file to be used for both standard input and standard output. No file descriptor necessary.
COMMANDS
COMMAND1 | COMMAND2
link stdout from COMMAND1 to stdin of COMMAND2
COMMANDS
tee
display stdin on stdout and save it to the specified files
COMMANDS
xargs [ options ] [ command [ initial-arguments ]]
run command once for every word passed to it on standard input
find / -user Christine | xargs -d “” \ n”” rm
COMMANDS
COMMAND
a separate command whose results are substituted on the command line
rm ` find . / -user Christine `
COMMANDS
$(COMMAND)
a separate command whose results are substituted on the command line
rm $(find ./ -user Christine)
COMMANDS
cat
concatenate files and print on the standard output
COMMANDS
tac
concatenate files and print on the standard output in reverse line order
COMMANDS
join
For each pair of input lines with identical join fields; write a line to standard output. The default join field is the first; delimited by blanks.
Fields are typically space-separated entries on a line
COMMANDS
paste
Write lines consisting of the sequentially corresponding lines from each FILE; separated by TABs; to standard output
COMMANDS
expand
Convert tabs in each FILE to spaces; writing to standard output.
assumes a tab stop every eight characters
COMMANDS
od
dump files in octal and other formats
COMMANDS
sort
sort lines of text files
COMMANDS
split
Output pieces of FILE to PREFIXaa; PREFIXab; …; default size is 1000 lines; and default PREFIX is ‘x’.
split -l 2 listing1.1.txt numbers
COMMANDS
tr [ options ] SET1 [ SET2 ]
Translate; squeeze; and/or delete characters from standard input; writing to standard output tr BCJ bc < listing1.1.txt B is replaced with b C is replaced with c J is replaced with c
COMMANDS
unexpand
unexpand - convert spaces to tabs
defaults to 8
COMMANDS
uniq
report or omit repeated lines
COMMANDS
fmt
Reformat each paragraph in the FILE(s); writing to standard output.
(default of 75 columns)
COMMANDS
nl
number lines of files (non empty)
the similar to ““cat -b”” by default
COMMANDS
pr
Paginate or columnate FILE(s) for printing
defaults to 80 columns
COMMANDS
head
Print the first 10 lines of each FILE to standard output. With more than one FILE; precede each with a header giving the file name.
COMMANDS
tail
Print the last 10 lines of each FILE to standard output. With more than one FILE; precede each with a header giving the file name.
COMMANDS
less
Less is a program similar to more (1); but it has many more features.
COMMANDS
cut
Print selected parts of lines from each FILE to standard output.
COMMANDS
wc
Print newline; word; and byte counts for each FILE; and a total line if more than one FILE is specified. A word is a non-zero-length sequence of characters delimited by white space.
COMMANDS
grep
searches for PATTERN in each FILE
COMMANDS
sed
stream editor for filtering and transforming text
sed [ options ] -f script-file [ input-file ]
sed [ options ] script-text [ input-file ]
COMMANDS
rpm
RPM Package Manager
COMMANDS
rpm2cpio
converts the .rpm file specified as a single argument to a cpio archive on standard out. If a ‘-‘ argument is given; an rpm stream is read from standard in.
COMMANDS
cpio
copy files to and from archives
find ./my-work | cpio -o > /media/usb/my-work.cpio
cpio -i < /media/usb/my-work.cpio
COMMANDS
yum
a repository based rpm manage
used by: Red Hat; CentOS; Fedora; and some other RPM-based distributions
not usd by: SUSE and Mandriva;
COMMANDS
yumdownloader
yumdownloader is a program for downloading RPMs from Yum repositories
COMMANDS
kyum
a gui frontend for yum
also yumex
COMMANDS
yumex
a gui frontend for yum
also kyum
COMMANDS
dpkg
debian’s equivelant of rpm
COMMANDS
dselect
a high-level interactive package browser. Using it; you can select packages to install on your system from the APT archives defined in /etc/apt/sources.list ; review the packages that are already installed on your system; uninstall packages; and upgrade packages.
COMMANDS
apt-get
debian’s equivelant of yum
COMMANDS
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. The metadata is acquired and updated via the ‘update’ command of e.g. apt-get; so that it can be outdated if the last update is too long ago; but in exchange apt-cache works independently of the availability of the configured sources (e.g. offline).
COMMANDS
aptitude
a text based debian package manager with an optional interactive mode that is similar to dselect
COMMANDS
synaptic
a X gui program similar to dselect or aptitude
COMMANDS
dpkg-reconfigure
reconfigures packages after they have already been installed. Pass it the names of a package or packages to reconfigure. It will ask configuration questions; much like when the package was first installed.
COMMANDS
alien
converts between Red Hat rpm; Debian deb; Stampede slp; Slackware tgz; Solaris pkg; and tarballs
requires that you have appropriate package manager software installed—for instance; both RPM and Debian—to convert between these formats
When converting from a tarball; alien copies the files directly as they had been in the tarball; so alien works only if the original tarball has files that should be installed off the root ( / ) directory of the system
COMMANDS
$LD_LIBRARY_PATH
This environment variable specifies additional directories the system is to search for libraries
Does not require ldconfig for changes to take effect
COMMANDS
ldd
prints the shared objects (shared libraries) required by each program or shared object specified on the command line.
COMMANDS
ldconfig
usually called without any options
updates caches and links used by the system for locating libraries—that is; it reads /etc/ld.so.conf and implements any changes in that file or in the directories to which it refers
COMMANDS
uname
Print certain system information. With no OPTION; same as -s
node(host) name; kernel name; kernel version; kernel release; machine; processor; hardware platform; os name
COMMANDS
ps
ps displays information about a selection of the active processes.
COMMANDS
top
provides a dynamic real-time view of a running system
COMMANDS
free
displays the total amount of free and used physical and swap memory in the system; as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo. T
COMMANDS
uptime
gives a one line display of the following information. The current time; how long the system has been running; how many users are currently logged on; and the system load averages for the past 1; 5; and 15 minutes
the same information displayed in the header of w
COMMANDS
jobs
displays minimal information about the processes associated with the current session
COMMANDS
pgrep
looks through the currently running processes and lists the process IDs which match the selection criteria to stdout.
pgrep -u root cron
COMMANDS
bg
move the specified job to the background, or start the first background process if it is stopped
COMMANDS
fg
bring the specified job to the foreground
COMMANDS
nice
Run COMMAND with an adjusted niceness (defaults to 10); which affects process scheduling. With no COMMAND; print the current niceness.
COMMANDS
renice
renice alters the scheduling priority of one or more running processes.
renice 7 16580 -u pdavison tbaker
COMMANDS
kill
send a signal to a process
The default signal for kill is TERM.
used to stop programs
COMMANDS
nohup
Run COMMAND; ignoring hangup signals
COMMANDS
killall
kill processes by name
killall vi
COMMANDS
pkill
allows you to kill one or more processes based on usernames; user IDs; group IDs; and other features as well as using a matching regular expression
COMMANDS
setpci
a utility for querying and configuring PCI devices.
COMMANDS
lspci
utility for displaying information about PCI buses in the system and devices connected to them
COMMANDS
lsmod
a trivial program which nicely formats the contents of the /proc/modules (kernel modules)
COMMANDS
insmod
a trivial program to insert a module into the kernel. Most users will want to use modprobe(8) instead; which is more clever and can handle module dependencies. e.g. insmod /lib/modules/3.16.6/kernel/drivers/bluetooth/bluetooth.ko
COMMANDS
modprobe
intelligently adds or removes a module from the Linux kernel e.g. modprobe bluetooth
COMMANDS
rmmod
a trivial program to remove a module (when module unloading support is provided) from the kernel. Most users will want to use modprobe(8) with the -r option instead.
COMMANDS
lsusb
a utility for displaying information about USB buses in the system and the devices connected to them
COMMANDS
pvcreate
initialize a disk or partition for use by LVM
COMMANDS
vgcreate
create a volume group (for LVM)
COMMANDS
lvcreate
create a logical volume in an existing volume group (for LVM)
COMMANDS
lvscan
scan (all disks) for Logical Volumes (for LVM)
COMMANDS
fdisk
a dialog-driven program for creation and manipulation of partition tables. It understands GPT; MBR; Sun; SGI and BSD partition tables.
the book says this tool can’t do GPT even though it can
e.g. fdisk /dev/hda
COMMANDS
gdisk
GPT fdisk (aka gdisk) is a text-mode menu-driven program for creation and manipulation of partition tables
COMMANDS
mkfs
build a Linux filesystem
deprecated in favour of filesystem specific mkfs. utils
mkfs -t ext3 /dev/sda6
COMMANDS
mkswap
sets up a Linux swap area on a device or in a file
mkswap /dev/sda7
COMMANDS
swapon
used to specify devices on which paging and swapping are to take place
/dev/sda7
COMMANDS
dumpe2fs
dump ext2/ext3/ext4 filesystem information
prints the super block and blocks group information for the filesystem present on device
COMMANDS
xfs_info
like dumpe2fs but for xfs; displays filesystem info
COMMANDS
xfs_metadump
copies the filesystem’s metadata (filenames; file sizes; and so on) to a file
COMMANDS
tune2fs
enables you to change many of the filesystem parameters that are reported by dumpe2fs
adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems
COMMANDS
fsck
check and repair a Linux filesystem
COMMANDS
xfs_admin
xfs equivelant to tune2fs
xfs_admin -L av_data /dev/sda7
COMMANDS
blkid
display the label and UUID of any partition’s filesystem
COMMANDS
debugfs
provides the abilities of dumpe2fs ; tune2fs ; and many of Linux’s normal file-manipulation tools all rolled into one
an interactive file system debugger. It can be used to examine and change the state of an ext2; ext3; or ext4 file system
e.g. debugfs /dev/sda11
COMMANDS
xfs_db
xfs equivelant to debugfs; only for experts
COMMANDS
df
report file system disk space usage
COMMANDS
du
estimate file space usage
COMMANDS
mount
mount a filesystem
mount /dev/sdb7 /mnt/shared
COMMANDS
umount
unmount file systems
COMMANDS
ls
list directory contents
COMMANDS
cp
make a copy
COMMANDS
mv
move (rename) files
COMMANDS
rm
remove files or directories
COMMANDS
touch
Update the access and modification times of each FILE to the current time
COMMANDS
tar
an archiving utility
COMMANDS
gzip
compress or expand files; oldest least compression
COMMANDS
bzip2
a block-sorting file compressor; improved over gzip
COMMANDS
xz
Compress or decompress .xz and .lzma files newest and best compression compared to gzip and bzip2
COMMANDS
dd
Copy a file; converting and formatting according to the operands.
very low level
COMMANDS
ln
make links between files
ln [options] source link
you can’t make hard links to directories
COMMANDS
mkdir
make directories
COMMANDS
rmdir
remove empty directories
COMMANDS
chown
change file owner and group
chown [ options ] [ newowner ][: newgroup ] filenames
eg. chown sally:skyhook forward.odt
Ordinary users may use chown to change the group of files that they own; provided that the users belong to the target group
COMMANDS
chmod
change file mode bits (permissions)
chmod [ options ] [ mode [; mode… ]] filename…
COMMANDS
umask
sets the bits that will be removed from 777 for directories and 666 for files when a new file/directory is created
COMMANDS
newgrp
set the users default group
newgrp mygroup
COMMANDS
chattr
change file attributes on a Linux file system
COMMANDS
lsattr
display file attributes
COMMANDS
quotaon
turn on disk quotas
COMMANDS
quotaoff
turn off disk quotas
COMMANDS
quotacheck
surveys the filesystem needing quotas and builds current disk usage data records.
e.g. create needed files and check the user quota on home: quotacheck -cu /home
COMMANDS
edquota
open a text editor to edit quotas
COMMANDS
repquota
summarizes the quota information about the filesystem you specify or on all filesystems if you pass it the -a option
COMMANDS
quota
display disk usage and limits
COMMANDS
find
search for files in a directory hierarchy
COMMANDS
locate
reads one or more databases prepared by updatedb(8) and writes file names matching at least one of the PATTERNs
COMMANDS
updatedb
creates or updates a database used by locate(1)
COMMANDS
whereis
searches for files in a restricted set of locations; such as standard binary file directories; library directories; and man page directories.
COMMANDS
which
searches your path for the command that you type and lists the complete path to the first match it finds
COMMANDS
grub-install
installs grub legacy grub-install /dev/sda grub-install '(hd0)' install to bootsector instead of MBR: /dev/sda1 or (hd0;0)
COMMANDS
efibootmgr
manipulate the EFI Boot Manager
efibootmgr -c -l \EFI\redhat\grub.efi -L GRUB
COMMANDS
update-grub
apply changes from /etc/default/grub and /etc/grub.d/ to /boot/grub/grub.cfg or grub-mkconfig some versions output to stdio; if so redirect them to the file /boot/grub/grub.cfg
COMMANDS
dmesg
print or control the kernel ring buffer kernel and module log messages sometimes it's in /var/log/dmesg
COMMANDS
chkconfig
(SysV) updates and queries runlevel information for system services
COMMANDS
runlevel
returns the previous and current runlevel
COMMANDS
init
reread the /etc/inittab file and change runlevels
COMMANDS
telinit
just like init; but telinit [qQ] will re-read the /etc/inittab
COMMANDS
shutdown
shutdown the machine
shutdown -h +15 ““system going down for maintenance””
COMMANDS
halt
halt the machine
COMMANDS
reboot
reboot the machine
COMMANDS
poweroff
poweroff the machine
COMMANDS
systemctl
Control the systemd system and service manager
COMMANDS
journalctl
Query the systemd journal
SWITCHES
type -a
returns all of the places that contain an executable named file
SWITCHES
uname -a
show all information
SWITCHES
history -c
clear the history
SWITCHES
man -k
search man pages for a topic; requires the whatis database to work
man -k ““system information””
SWITCHES
man #
select the section in the man page to open
man 5 passwd
SWITCHES
xargs -d
specify the delimiter
defaults to space
SWITCHES
cat -E
display a “”$”” at the end of each line
–show-ends
SWITCHES
cat -n
adds line numbers to the beginning of every line.
–number
SWITCHES
cat -b
adds line numbers to the beginning of every line that contains text
–number-nonblank
SWITCHES
cat -s
compresses groups of blank lines down to a single blank line
–squeeze-blank
SWITCHES
cat -T
displays tab characters as ““∧I””
–show-tabs
SWITCHES
cat -v
displays most control and other special characters using carat ( ∧ ) and M- notations.
–show-nonprinting
SWITCHES
join -t CHAR
use CHAR as input and output field separator
SWITCHES
join -i
ignore differences in case when comparing fields
–ignore-case
SWITCHES
expand -t NUMBER
have tabs NUMBER characters apart; not 8
–tabs=NUMBER
SWITCHES
sort -f
ignore case
–ignore-case; (fold)
SWITCHES
sort -M
sort by three-letter month abbreviation ( JAN through DEC )
–month-sort
SWITCHES
sort -n
compare according to string numerical value
–numeric-sort
SWITCHES
sort -r
reverse the result of comparisons
–reverse
SWITCHES
sort -k KEYDEF
sort via a key; KEYDEF gives location and type
–key=KEYDEF
(KEYDEF can be two numbered fields separated by commas; to sort on multiple fields.)
E.G. sort -k 3 listing1.1.txt
SWITCHES
split -b NUMBER
put NUMBER bytes per output file
–bytes=NUMBER
SWITCHES
split -C NUMBER
put at most NUMBER bytes of records per output file
–line-bytes=NUMBER
SWITCHES
split -l NUMBER
put NUMBER lines/records per output file
–lines=NUMBER
SWITCHES
tr -t
first truncate SET1 to length of SET2
–truncate-set1
SWITCHES
tr -d
delete characters in SET1; do not translate
–delete
SWITCHES
unexpand -t LIST
use comma separated LIST of tab positions (enables -a)
–tabs=LIST
SWITCHES
fmt -w NUMBER
maximum line width (default of 75 columns)
–width=NUMBER
SWITCHES
nl -b STYLE
use STYLE for numbering body lines
–body-numbering=STYLE
STYLE is:
t (The default behavior is to number lines that aren’t empty. You can make this default explicit by using a style code of t .)
a (This style code causes all lines to be numbered; including empty lines.)
n (This style code causes all line numbers to be omitted; which may be desirable for headers or footers.)
pREGEXP (This option causes only lines that match the specified regular expression ( REGEXP ) to be numbered.)
SWITCHES
nl -h STYLE
use STYLE for numbering header lines
–header-numbering=STYLE
STYLE is: t (The default behavior is to number lines that aren’t empty. You can make this default explicit by using a style code of t .) a (This style code causes all lines to be numbered; including empty lines.) n (This style code causes all line numbers to be omitted; which may be desirable for headers or footers.)
pREGEXP (This option causes only lines that match the specified regular expression ( REGEXP ) to be numbered.)
SWITCHES
nl -f STYLE
use STYLE for numbering footer lines
–footer-numbering=STYLE
STYLE is: t (The default behavior is to number lines that aren’t empty. You can make this default explicit by using a style code of t .) a (This style code causes all lines to be numbered; including empty lines.) n (This style code causes all line numbers to be omitted; which may be desirable for headers or footers.)
pREGEXP (This option causes only lines that match the specified regular expression ( REGEXP ) to be numbered.)
SWITCHES
nl -d CC
use CC for logical page delimiters
–section-delimiter=CC
SWITCHES
nl -n FORMAT
insert line numbers according to FORMAT --number-format=FORMAT format is: ln (left justified; no leading zeros); rn (right justified; no leading zeros); rz (right justified with leading zeros).
SWITCHES
pr -NUMBER
output COLUMN columns and print columns down; unless -a is used
–columns=NUMBER
default is 80
SWITCHES
pr -d
double space the output
–double-space
SWITCHES
pr -f
use form feeds instead of newlines to separate pages (by a 3-line page header with -F or a 5-line header and trailer without -F)
- -form-feed
- F
SWITCHES
pr -l NUMBER
set the page length to PAGE_LENGTH (66) lines (default number of lines of text 56; and with -F 63). implies -t if PAGE_LENGTH <= 10
–length=NUMBER
SWITCHES
pr -h STRING
use a centered STRING instead of filename in page header; -h “””” prints a blank line; don’t use -h””””
–header=STRING
SWITCHES
pr -t
omit page headers and trailers; implied if PAGE_LENGTH <= 10
–omit-header
SWITCHES
pr -o
offset each line with MARGIN (zero) spaces; do not affect -w or -W; MARGIN will be added to PAGE_WIDTH
–indent=NUMBER
SWITCHES
pr -w NUMBER
set page width to NUMBER (72) characters for multiple text-column output only; -s[char] turns off (72)
–width=NUMBER
SWITCHES
head -c NUMBER
print the first NUM bytes of each file; with the leading ‘-‘; print all but the last NUM bytes of each file
–bytes=[-]NUMBER
SWITCHES
head -n NUMBER
print the first NUM lines instead of the first 10; with the leading ‘-‘; print all but the last NUM lines of each file
–lines=[-]NUMBER
SWITCHES
tail -c NUMBER
output the last NUMBER bytes; or use -c +NUMBER to output starting with byte NUMBER of each file
–bytes=[+]NUMBER
SWITCHES
tail -n NUMBER
output the last NUM lines; instead of the last 10; or use -n +NUM to output starting with line NUM
–lines=[+]NUMBER
SWITCHES
tail -f
output appended data as the file grows;
–follow[={name|descriptor}]
SWITCHES
tail –pid=NUMBER
with -f; terminate after process ID; PID dies
SWITCHES
cut -b LIST
select only these bytes
–bytes=LIST
LIST can be a single number (such as 4 ); a closed range of numbers (such as 2-4 ); or an open range of numbers (such as -4 or 4- ).
SWITCHES
cut -c LIST
select only these characters
–characters=LIST
LIST can be a single number (such as 4 ); a closed range of numbers (such as 2-4 ); or an open range of numbers (such as -4 or 4- ).
SWITCHES
cut -f LIST
select only these fields; also print any line that contains no delimiter character; unless the -s option is specified
–fields=LIST
LIST can be a single number (such as 4 ); a closed range of numbers (such as 2-4 ); or an open range of numbers (such as -4 or 4- ).
SWITCHES
cut -d STRING
use DELIM instead of TAB for field delimiter
–delimiter=STRING
SWITCHES
cut -s
do not print lines not containing delimiters
–only-delimited
SWITCHES
wc -l
print the newline counts
–lines
SWITCHES
wc -w
print the word counts
–words
SWITCHES
wc -c
print the byte counts
–bytes
SWITCHES
wc -m
print the character counts
–chars
SWITCHES
wc -L
print the maximum display width
–max-line-length
SWITCHES
grep -c
Suppress normal output; instead print a count of matching lines for each input file. With the -v; –invert-match option (see below); count non-matching lines.
–count
SWITCHES
grep -f STRING
Obtain patterns from file STRING; one per line. If this option is used multiple times or is combined with the -e (–regexp) option; search for all patterns given. The empty file contains zero patterns; and therefore matches nothing.
–file=STRING
SWITCHES
grep -i
Ignore case distinctions; so that characters that differ only in case match each other.
–ignore-case
SWITCHES
grep -r
Read all files under each directory; recursively; following symbolic links only if they are on the command line. Note that if no file operand is given; grep searches the working directory. This is equivalent to the -d recurse option.
–recursive
or use rgrep
SWITCHES
grep -F
Interpret PATTERN as a list of fixed strings (instead of regular expressions); separated by newlines; any of which is to be matched.
–fixed-strings
or use fgrep
SWITCHES
grep -E
Interpret PATTERN as an extended regular expression (ERE; see below).
–extended-regexp
or use egrep
SWITCHES
sed =
Display the current line number
SWITCHES
sed a\text
Append text to the file.
SWITCHES
sed i\text
Insert text into the file
SWITCHES
sed r filename
Append text from filename into the file
SWITCHES
sed c\text
Replace the selected range of lines with the provided text
SWITCHES
sed s/regexp/replacement/[g]
Replace text that matches the regular expression ( regexp ) with replacement
SWITCHES
sed w filename
Write the current pattern space to the specified file.
SWITCHES
sed q
Immediately quit the script; but print the current pattern space.
SWITCHES
sed Q
Immediately quit the script.
SWITCHES
rpm –root STRING
Modifies the Linux system having a root directory located at dir . This option can be used to maintain one Linux installation discrete from another one (say; during OS installation or emergency maintenance).
SWITCHES
rpm –force
Forces installation of a package even when it means overwriting existing files or packages.
used with: -i ; -U ; -F
SWITCHES
rpm -h
Displays a series of hash marks ( # ) to indicate the progress of the operation.
–hash
used with: -i ; -U ; -F
SWITCHES
rpm -v
Used in conjunction with the -h option to produce a uniform number of hash marks for each package.
used with: -i ; -U ; -F
SWITCHES
rpm –nodeps
Specifies that no dependency checks be performed. Installs or removes the package even if it relies on a package or file that’s not present or is required by a package that’s not being uninstalled.
used wih: -i ; -U ; -F ; -e
SWITCHES
rpm –test
Checks for dependencies; conflicts; and other problems without actually installing the package.
used with: -i ; -U ; -F
SWITCHES
rpm –prefix STRING
Sets the installation directory to STRING (works only for some packages).
used with: -i ; -U ; -F
SWITCHES
rpm -a
Queries or verifies all packages.
–all
used with: -q ; -V
SWITCHES
rpm -f STRING
Queries or verifies the package that owns file
–file STRING
used with: -q ; -V
SWITCHES
rpm -p STRING
Queries the uninstalled RPM STRING
used with -q
SWITCHES
rpm -i
Displays package information; including the package maintainer; a short description; and so on
used with -q
SWITCHES
rpm -R
Displays the packages and files on which this one depends
–requires
used with -q
SWITCHES
rpm -l
Displays the files contained in the package.
–list
used with -q
SWITCHES
rpm -i
Installs a package; system must not contain a package of the same name
SWITCHES
rpm -U
Installs a new package or upgrades an existing one
SWITCHES
rpm -F
Upgrades a package only if an earlier version already exists
–freshen
SWITCHES
rpm -q
Queries a package—finds whether a package is installed; what files it contains; and so on
SWITCHES
rpm -v
Verifies a package—checks that its files are present and unchanged since installation
–verify
SWITCHES
rpm -e
Uninstalls a package
SWITCHES
rpm -b
Builds a binary package; given source code and configuration files; moved to the rpmbuild program with RPM version 4.2
SWITCHES
rpm –rebuild
Builds a binary package; given a source RPM file; moved to the rpmbuild program with RPM version 4.2
SWITCHES
rpm –rebuilddb
Rebuilds the RPM database to fix errors
SWITCHES
cpio -i
extract an archive
SWITCHES
cpio –make-directories
create directories
SWITCHES
yum install
Installs one or more packages by package name. Also installs dependencies of the specified package or packages.
SWITCHES
yum update
Updates the specified package or packages to the latest available version. If no packages are specified; yum updates every installed package.
SWITCHES
yum check-update
Checks to see whether updates are available. If they are; yum displays their names; versions; and repository area ( updates or extras ; for instance).
SWITCHES
yum upgrade
Works like update with the –obsoletes flag set; which handles obsolete packages in a way that’s superior when performing a distribution version upgrade
SWITCHES
yum remove
Deletes a package from the system; similar to rpm -e ; but yum also removes depended-on packages
or erase
SWITCHES
yum list
Displays information about a package; such as the installed version and whether an update is available
SWITCHES
yum provides
Displays information about packages that provide a specified program or feature. For instance; typing yum provides samba lists all the Samba-related packages; including every available update. Note that the output can be copious.
or whatprovides
SWITCHES
yum search
Searches package names; summaries; packagers; and descriptions for a specified keyword. This is useful if you don’t know a package’s name but can think of a word that’s likely to appear in one of these fields but not in these fields for other packages
SWITCHES
yum info
Displays information about a package; similar to the rpm -qi command
SWITCHES
yum clean
Cleans up the Yum cache directory. Running this command from time to time is advisable; lest downloaded packages chew up too much disk space.
SWITCHES
yum shell
Enters the Yum shell mode; in which you can enter multiple Yum commands one after another
SWITCHES
yum resolvedep
Displays packages matching the specified dependency.
SWITCHES
yum localinstall
Installs the specified local RPM files; using your Yum repositories to resolve dependencies
SWITCHES
yum localupdate
Updates the system using the specified local RPM files; using your Yum repositories to resolve dependencies. Packages other than those updated by local files and their dependencies are not updated
SWITCHES
yum deplist
Displays dependencies of the specified package.
SWITCHES
dpkg -i
Installs a package
–install
SWITCHES
dpkg –configure
Reconfigures an installed package: runs the post-installation script to set site-specific options
SWITCHES
dpkg -r
Removes a package but leaves configuration files intact
–remove
SWITCHES
dpkg -P
Removes a package; including configuration files
–purge
SWITCHES
dpkg –get-selections
Displays currently installed packages
SWITCHES
dpkg -p
Displays information about an installed package
–print-avail
SWITCHES
dpkg -I
Displays information about an uninstalled package file
–info
SWITCHES
dpkg -l STRING
Lists all installed packages whose names match pattern
–list pattern
SWITCHES
dpkg -L
Lists the installed files associated with a package
–listfiles
SWITCHES
dpkg -S STRING
Locates the package(s) that own the file(s) specified by pattern
–search pattern
SWITCHES
dpkg -c
pattern -C or –audit Searches for partially installed packages and suggests what to do with them
–audit
SWITCHES
dpkg –root=STRING
Modifies the Linux system using a root directory located at STRING . Can be used to maintain one Linux installation discrete from another one; say during OS installation or emergency maintenance.
used with: all
SWITCHES
dpkg -B
Disables packages that rely on one that is being removed.
–auto-deconfigure
used with -r
SWITCHES
dpkg –force-things
Overrides defaults that would ordinarily cause dpkg to abort. Consult the dpkg man page for details of what (specified by things ) this option does.
used with: assorted
SWITCHES
dpkg –ignore-depends=package
ignores dependency information for the specified package
used with: -i; -r
SWITCHES
dpkg –no-act
Checks for dependencies; conflicts; and other problems without actually installing or removing the package
used with: -i; -r
SWITCHES
dpkg –recursive
Installs all packages that match the package-name wildcard in the specified directory and all subdirectories
used with: -i
SWITCHES
dpkg -G
Doesn’t install the package if a newer version of the same package is already installed.
used with: -i
SWITCHES
dpkg -E
Doesn’t install the package if the same version of the package is already installed.
–skip-same-version
used with: -i
SWITCHES
apt-cache showpkg
displays information about the packages listed on the command line.
eg: apt-cache showpkg samba
SWITCHES
apt-cache stats
You can learn how many packages you’ve installed; how many dependencies are recorded; and various other statistics about the package database
SWITCHES
apt-cache unmet
Find Unmet Dependencies
SWITCHES
apt-cache depends
Display Dependencies
SWITCHES
apt-cache pkgnames
Locate All Packages
If you include a second parameter; as in apt-cache pkgnames sa ; the program returns only those packages that begin with the specified string.
SWITCHES
apt-get -d
Downloads package files but doesn’t install them.
–download-only
used with: upgrade ; dselect- upgrade ; install ; source
SWITCHES
apt-get -f
Attempts to fix a system on which dependencies are unsatisfied.
–fix-broken
used with: install ; remove
SWITCHES
apt-get -m
Ignores all package files that can’t be retrieved (because of network errors; missing files; or the like)
–ignore-missing ; or –fix-missing
used with: upgrade ; dselect- upgrade ; install ; remove ; source
SWITCHES
apt-get -q
Omits some progress indicator information. May be doubled (for instance; -qq ) to produce still less progress information
–quiet
used with: all
SWITCHES
apt-get -s
Performs a simulation of the action without actually modifying; installing; or removing files
–simulate ; –just- print ; –dry-run ; – recon ; or –no-act
used with: all
SWITCHES
apt-get -y
Produces a ““yes’’ response to any yes/no prompt in installation scripts.
–yes ; or –assume- yes
used with: all
SWITCHES
apt-get -b
Compiles a source package after retrieving it.
–compile; or –build
used with: source
SWITCHES
apt-get –no-upgrade
auses apt-get to not upgrade a package if an older version is already installed.
used with: install
SWITCHES
apt-get update
Obtains updated information about packages available from the installation sources listed in /etc/apt/sources.list .
SWITCHES
apt-get upgrade
Upgrades all installed packages to the newest versions available; based on locally stored information about available packages.
SWITCHES
apt-get dselect-upgrade
Performs any changes in package status (installation; removal; and so on) left undone after running dselect .
SWITCHES
apt-get dist-upgrade
Similar to upgrade ; but performs ``smart’’ conflict resolution to avoid upgrading a package if doing so would break a dependency.
SWITCHES
apt-get install
Installs a package by package name (not by package filename); obtaining the package from the source that contains the most up-to-date version.
SWITCHES
apt-get remove
Removes a specified package by package name
SWITCHES
apt-get source
Retrieves the newest available source package file by package filename using information about available packages and installation archives listed in /etc/apt/sources.list
SWITCHES
apt-get check
Checks the package database for consistency and broken package installations
SWITCHES
apt-get clean
Performs housekeeping to help clear out information about retrieved files from the Debian package database. If you don’t use dselect for package management; run this from time to time in order to save disk space.
SWITCHES
apt-get autoclean
Similar to clean ; but removes information only about packages that can no longer be downloaded.
SWITCHES
aptitude install STRING
install package STRING
SWITCHES
aptitude install STRING-
uninstall package STRING
also remove STRING
SWITCHES
aptitude remove STRING
uninstall package STRING
also install STRING-
SWITCHES
aptitude full-upgrade
less conservative about removing packages in the upgrade process; and so it is more likely to complete its tasks. However; it may break software in the process.
SWITCHES
aptitude safe-upgrade
conservative about removing packages or installing new ones and so may fail
SWITCHES
aptitude search
earches the database for packages matching the specified name
SWITCHES
aptitude autoclean
removes already-downloaded packages that are no longer available
SWITCHES
aptitude clean
removes all downloaded packages
SWITCHES
aptitude help
displays a complete list of options.
SWITCHES
alien –to-deb
converts to debian
SWITCHES
alien –to-rpm
converts to rpm
SWITCHES
alien –to-tgz
converts to tgz
SWITCHES
ldconfig -v
Display Verbose Information
SWITCHES
ldconfig -N
causes ldconfig not to perform its primary duty of updating the library cache. It will; though; update symbolic links to libraries; which is a secondary duty of this program.
SWITCHES
ldconfig -n
causes ldconfig to update the links contained in the directories specified on the command line. The system won’t examine the directories specified in /etc/ld.so.conf or the trusted directories ( /lib and /usr/lib )
SWITCHES
ldconfig -X
the opposite of -N ; it causes ldconfig to update the cache but not manage links.
SWITCHES
ldconfig -f STRING
change the configuration file from /etc/ld.so.conf to STRING
SWITCHES
ldconfig -C STRING
change the cache file that ldconfig creates to STRING
SWITCHES
ldconfig -r STRING
tells ldconfig to treat dir as if it were the root ( / ) directory. This option is helpful when you’re recovering a badly corrupted system or installing a new OS
SWITCHES
ldconfig -p
Causes ldconfig to display the current cache—all of the library directories and the libraries they contain
SWITCHES
uname -a
display all information
SWITCHES
uname -n
displays the system’s node name; that is; its network hostname.
–nodename
SWITCHES
uname -s
displays the kernel name; which is Linux on a Linux system
–kernel-name
SWITCHES
uname -v
find the kernel version
–kernel-version
SWITCHES
uname -r
The actual kernel version number
–kernel-release
SWITCHES
uname -m
returns information about your machine. This is likely to be a CPU code; such as i686 or x86_64 .
–machine
SWITCHES
uname -p
may return information about your CPU; such as the manufacturer; model; and clock speed; in practice; it returns unknown on many systems
–processor
SWITCHES
uname -i
theoretically returns hardware platform information; this option often returns unknown
–hardware-platform
SWITCHES
uname -o
returns the OS name—normally GNU/Linux for a Linux system
–operating-system
SWITCHES
ps –help
Display Help
SWITCHES
ps -A
Display All Processes
also -e
SWITCHES
ps -e
Display All Processes
also -A
SWITCHES
ps x
Lift the BSD-style ““must have a tty”” restriction;
displays all processes owned by the user who gives the command
SWITCHES
ps -u STRING
display processes owned by user STRING
–User user
also U STRING
STRING may be a user name or uid
SWITCHES
ps U STRING
display processes owned by user STRING
–User user
also U STRING
STRING may be a user name or uid
SWITCHES
ps -H
Display Process Hierarchy
–forest
also -f
SWITCHES
ps -f
Display Process Hierarchy
–forest
also -f
SWITCHES
ps -w
don’t truncate output at 80 columns
also w
SWITCHES
top -d NUMBER
how often top updates
defaults to 5 seconds
SWITCHES
top -p NUMBER
only display the listed processes
NUMBER is a pid
up to 20 pids can be listed
SWITCHES
top -n NUMBER
display NUMBER updates then quit
SWITCHES
top -b
specifies batch mode; in which top doesn’t use the normal screen-update commands. You might use this to log CPU use of targeted programs to a file; for instance
SWITCHES
top h while running
display help
also ?
SWITCHES
top k while running
kill a process
SWITCHES
top q while running
quit
SWITCHES
top r while running
change a process’s priority
SWITCHES
top s while running
changes the display’s update rate
SWITCHES
top P while running
sets the display to sort by CPU usage; which is the default
SWITCHES
top M while running
change the display to sort by memory usage with this command
SWITCHES
nice -n NUMBER
run the program with NUMBER niceness
also -NUMBER
–adjustment=NUMBER
SWITCHES
nice -NUMBER
run the program with NUMBER niceness
also -n NUMBER
–adjustment=NUMBER
SWITCHES
renice [-n] NUMBER
Specify the scheduling priority to be used for the process; process group; or user.
–priority NUMBER
SWITCHES
renice -p NUMBER
change niceness on the pid NUMBER
SWITCHES
renice -g NUMBER
change niceness on the gid NUMBER
SWITCHES
renice -u NUMBER
change niceness on the uid NUMBER
e.g. renice 7 16580 -u pdavison tbaker
SWITCHES
kill -l
List signal names
SWITCHES
kill -s STRING
specify the signal to send
common signals are 1(SIGHUP); 9(SIGKILL); 15(SIGTERM)
SWITCHES
killall -i
Interactively ask for confirmation before killing
–interactive
SWITCHES
lspci -v
Increases verbosity of output.
This option may be doubled ( -vv ) or tripled ( -vvv ) to produce yet more output
SWITCHES
lspci -n
Displays information in numeric codes rather than translating the codes to manufacturer and device names.
SWITCHES
lspci -nn
Displays both the manufacturer and device names and their associated numeric codes
SWITCHES
lspci -x
Displays the PCI configuration space for each device as a hexadecimal dump.
This is an extremely advanced option. Tripling ( -xxx ) or quadrupling ( -xxxx ) this option displays information about more devices
SWITCHES
lspci -b
hows IRQ numbers and other data as seen by devices rather than as seen by the kernel
SWITCHES
lspci -t
Displays a tree view depicting the relationship between devices
SWITCHES
lspci -s STRING
Displays only devices that match the listed specification. This can be used to trim the results of the output
-s [[[[ domain ]:] bus ]:] [ slot ][.[ func ]]
SWITCHES
lspci -d STRING
Shows data on the specified device.
-d [ vendor ]: [ device ]
SWITCHES
lspci -i STRING
Uses the specified file to map vendor and device IDs to names. (The default is /usr/share/misc/pci.ids .)
SWITCHES
lspci -m
Dumps data in a machine-readable form intended for use by scripts. A single -m uses a backward-compatible format; whereas doubling ( - mm ) uses a newer format
SWITCHES
lspci -D
Displays PCI domain numbers. These numbers normally aren’t displayed.
SWITCHES
lspci -M
Performs a scan in bus-mapping mode; which can reveal devices hidden behind a misconfigured PCI bridge. This is an advanced option that can be used only by root .
SWITCHES
lspci –version
Displays version information.
SWITCHES
modprobe -v
display extra information
–verbose
SWITCHES
modprobe -C STRING
This option overrides the default configuration directory (/etc/modprobe.d)
–config
SWITCHES
modprobe -n
This option does everything but actually insert or delete the modules
–dry-run
useful when combined with -v
SWITCHES
modprobe -r
Reverses modprobe 's usual effect; it causes the program to remove the specified module and any on which it depends --remove
SWITCHES
modprobe -f
force the module loading even if the kernel version doesn't match what the module expects. This action is potentially dangerous --force
SWITCHES
modprobe –show-depends
shows all of the modules on which the specified module depends
SWITCHES
modprobe -l STRING
displays a list of available options whose names match the wildcard you specify
- -list
eg. modprobe -l v* displays all modules whose names begin with v
SWITCHES
rmmod -v
display some extra information about what it’s doing
–verbose
SWITCHES
rmmod -f
forces module removal even if the module is marked as being in use. Naturally; this is a very dangerous option; --force
SWITCHES
rmmod -w
wait for the module to become unused rather than return an error message if the module is in use. Once the module is no longer being used (say; after a bluetooth device is disconnected); rmmod unloads the module and returns --wait
SWITCHES
lsusb -v
display more information
SWITCHES
lsusb -s STRING
restricts output to the specified bus and device number.
-s [[ bus ]:][ devnum ]
SWITCHES
lsusb -d STRING
restrict output to a particular vendor and product
-d [ vendor ]: [ product ]
SWITCHES
lsusb -D STRING
displays information about the device that’s accessible via filename ; which should be a file in the /proc/bus/usb directory tree
SWITCHES
lsusb -t
displays the device list as a tree so that you can see what devices are connected to specific controllers more easily
SWITCHES
lsusb -V
displays the version of the lsusb utility
–version
SWITCHES
fdisk -l
display the current partition table
SWITCHES
fdisk d while running
delete a partition
SWITCHES
fdisk m while running
display help
also ?
SWITCHES
fdisk t while running
change the partition type code
SWITCHES
fdisk l while running
display common partition type codes
SWITCHES
fdisk a while running
set the bootable flag
SWITCHES
fdisk q while running
exit
SWITCHES
fdisk w while running
save changes and exit
SWITCHES
gdisk print while running
display existing partitions
SWITCHES
mkfs -m NUMBER
sets the reserved-space percentage to NUMBER
SWITCHES
tune2fs -c NUMBER
Adjust the number of mounts after which the filesystem will be checked by e2fsck
SWITCHES
tune2fs -i NUMBER
Adjust the maximal time between two filesystem checks. No suffix or d will interpret the number interval-between-checks as days; m as months; and w as weeks. A value of zero will disable the time-dependent checking.
SWITCHES
tune2fs -j
converts ext2 to ext3
SWITCHES
tune2fs -r NUMBER
sets the reserved-space blocks to NUMBER
SWITCHES
xfs_admin -j
enable version 2 log (journal) format
SWITCHES
xfs_admin -l
obtain the filesystem’s label (name)
SWITCHES
xfs_admin -u
obtain the filesystem’s uuid
SWITCHES
xfs_admin -L STRING
set the filesystem’s label (name)
SWITCHES
xfs_admin -U STRING
set the filesystem’s uuid
SWITCHES
debugfs show_super_stats while running
produces superblock information; similar to what dumpe2fs displays
also stats
SWITCHES
debugfs stat STRING (while running)
display the inode data on a file or directory
STRING is the name of a file or directorhy
SWITCHES
debugfs undelete NUMBER STRING (while running)
undelete a file
also undel
NUMBER is the inode number and STRING is the name you want to give i
SWITCHES debugfs lsdel (while running)
obtain a list of deleted inodes
also list_deleted_inodes
SWITCHES
debugfs write STRING1 STRING2 (while running)
extract a file from the filesystem
STRING1 is the name of a file in the filesystem that you’re manipulating and STRING2 is a filename on your main Linux system.
SWITCHES debugfs list_requests (while running)
produces a summary of available commands
also lr; help; or ?
SWITCHES
debugfs quit
exit the program
SWITCHES
fsck -A
check all of the filesystems marked to be checked in /etc/fstab .
SWITCHES
fsck -c
displays a text-mode progress indicator of the check process
SWITCHES
fsck -v
produces verbose output of the check process
SWITCHES
fsck -N
display what it would normally do without actually doing it
SWITCHES
fsck -t STRING
causes the program to check only the specified filesystem types; even if others are marked to be checked
used with -A
If STRING is prefixed with no ; then all filesystems except the specified type are checked
SWITCHES
fsck –STRING
passes STRING to the underlying check program
SWITCHES
df -a
includes pseudo-filesystems with a size of 0 in the output. These filesystems may include /proc ; /sys ; /proc/bus/usb ; and others
–all
SWITCHES
df -h
scale and label its units
–human-readable
SWITCHES
df -H
scale and label its units using powers of 10
–si
SWITCHES
df -k
scale and label its units using kilobytes
–kilobytes
SWITCHES
df -m
scale and label its units using megabytes
–megabytes
SWITCHES
df -i
report on available and used inodes
–inodes
SWITCHES
df -l
omit network filesystems
–local
SWITCHES
df -T
display filesystem type
SWITCHES
df -t STRING
displays only information about filesystems of the specified type
–type=STRING
SWITCHES
df -x STRING
don’t display information about filesystems of the specified type
–exclude=STRING
SWITCHES
du -a
report on individual files as well.
–all
SWITCHES
du -c
add a grand total to the end of its output
–total
SWITCHES
du -h
scale and label its units;
–human-readable
SWITCHES
du -H
scale and label its units using powers of 10
–si
SWITCHES
du -k
scale and label its units using kilobytes
–kilobytes
SWITCHES
du -m
scale and label its units using megabytes
–megabytes
SWITCHES
du -l
count the space each hardlink takes (useful if you want to burn to optical storage)
–count-links
SWITCHES
du –max-depth=NUMBER
limits the report to NUMBER levels
SWITCHES
du -s
equivalent to –max=depth=0
–summarize
SWITCHES
du -x
limits the report to the current filesystem. If another filesystem is mounted within the tree that you want summarized; its contents aren’t included in the report
–one-file-system
SWITCHES
mount -a
mount all of the filesystems listed in the /etc/fstab
SWITCHES
mount -r
mount the filesystem read-only
SWITCHES
mount -v
produces verbose output
SWITCHES
mount -w
mount the filesystem for both read and write
also: -o rw
SWITCHES
mount -t STRING
specify the filesystem type
SWITCHES
mount -L STRING
mount the filesystem whose label matches STRING
SWITCHES
mount -U STRING
mount the filesystem whose UUID matches STRING
SWITCHES
mount -o defaults
Causes the default options for this filesystem to be used. It’s used primarily in the /etc/fstab file to ensure that the file includes an options column
supported filesystems: all
SWITCHES
mount -o loop
Causes the loopback device for this mount to be used. Allows you to mount a file as if it were a disk partition. For instance; mount -t vfat -o loop image.img /mnt/image mounts the file image.img as if it were a disk
supported filesystems: all
SWITCHES
mount -o auto or noauto
Mounts or doesn’t mount the filesystem at boot time or when root issues the mount -a command. The default is auto ; but noauto is appropriate for removable media. Used in /etc/fstab
supported filesystems: all
SWITCHES
mount -o user or nouser
Allows or disallows ordinary users to mount the filesystem. The default is nouser ; but user is often appropriate for removable media. Used in /etc/fstab . When included in this file; user allows users to type mount /mountpoint (where / mountpoint is the assigned mount point) to mount a disk. Only the user who mounted the filesystem may unmount it.
supported filesystems: all
SWITCHES
mount -o users
Similar to user ; except that any user may unmount a filesystem once it’s been mounted.
supported filesystems: all
SWITCHES
mount -o owner
Similar to user ; except that the user must own the device file. Some distributions; such as Red Hat; assign ownership of some device files (such as /dev/fd0 for the floppy disk) to the console user; so this can be a helpful option
supported filesystems: all
SWITCHES
mount -o remount
Changes one or more mount options without explicitly unmounting a partition. To use this option; you issue a mount command on an already-mounted filesystem but with remount along with any options that you want to change. This feature can be used to enable or disable write access to a partition; for example
supported filesystems: all
SWITCHES
mount -o ro
Specifies a read-only mount of the filesystem. This is the default for filesystems that include no write access and for some with particularly unreliable write support
supported filesystems: all
SWITCHES
mount -o rw
Specifies a read/write mount of the filesystem. This is the default for most read/write filesystems
supported filesystems: All read/write filesystems
SWITCHES
mount -o uid=NUMBER
Sets the owner of all files. For instance; uid=1000 sets the owner to whomever has Linux user ID 1000. (Check Linux user IDs in the /etc/passwd file.)
supported filesystmes: Most filesystems that don’t support Unix-style permissions; such as vfat ; hpfs ; ntfs ; and hfs
SWITCHES
mount -o gid=value
Works like uid= value ; but sets the group of all files on the filesystem. You can find group IDs in the /etc/group file
supported filesystems: Most filesystems that don’t support Unix-style permissions; such as vfat ; hpfs ; ntfs ; and hfs
SWITCHES
mount -o umask=value
Sets the umask for the permissions on files. value is interpreted in binary as bits to be removed from permissions on files. For instance; umask=027 yields permissions of 750; or –rwxr-x— . Used in conjunction with uid= value and gid= value ; this option lets you control who can access files on FAT; HPFS; and many other foreign filesystems.
supported filesystems: Most filesystems that don’t support Unix-style permissions; such as vfat ; hpfs ; ntfs ; and hfs
SWITCHES
mount -o dmask=value
Similar to umask ; but sets the umask for directories only; not for files.
supported filesystems: Most filesystems that don’t support Unix-style permissions; such as vfat ; hpfs ; ntfs ; and hfs
SWITCHES
mount -o fmask=value
Similar to umask ; but sets the umask for files only; not for directories.
supported filesystems: Most filesystems that don’t support Unix-style permissions; such as vfat ; hpfs ; ntfs ; and hfs
SWITCHES
mount -o conv=code
If code is b or binary ; Linux doesn’t modify the files’ contents. If code is t or text ; Linux auto-converts files between Linux-style and Windows- or Macintosh-style end-of-line characters. If code is a or auto ; Linux applies the conversion unless the file is a known binary file format. It’s usually best to leave this at its default value of binary because file conversions can cause serious problems for some applications and file types.
supported filesystems: Most filesystems used on Microsoft and Apple OSs: msdos ; umsdos ; vfat ; hpfs ; and hfs
SWITCHES
mount -o norock
Disables Rock Ridge extensions for ISO-9660 CD-ROMs.
supported filesystems: iso9660
SWITCHES
mount -o nojoliet
Disables Joliet extensions for ISO-9660 CD-ROMs.
supported filesystems: iso9660
SWITCHES
umount -a
attempt to unmount all of the partitions listed in /etc/mtab
SWITCHES
umount -f
force an unmount operation that might otherwise fail. This feature is sometimes helpful when unmounting NFS mounts shared by servers that have become unreachable
SWITCHES
umount -r
if it can’t unmount a filesystem; it should attempt to remount it in read-only mode
SWITCHES
umount -t STRING
unmount only partitions of the specified type. You can list multiple filesystem types by separating them with commas.
SWITCHES
ls -F
append indicator (one of */=>@|) to entries --classify / Directory * Executable | Named pipe = Socket @ Symbolic Link
SWITCHES
ls -a
show hidden files (dot)
–all
SWITCHES
ls -l
long listing
SWITCHES
ls –color
colored listing
SWITCHES
ls -d
only list the directory’s name; useful for globbing for directories
–directory
SWITCHES
ls -R
display directory contents recursively.
–recursive
SWITCHES
cp -f
overwrite any existing files without prompting
–force
SWITCHES
cp -i
prompt before overwriting
–interactive
SWITCHES
cp -p
preserves ownership and permissions; if possible
–preserve
SWITCHES
cp -R
copy recursively
–recursive
Although -r also performs a recursive copy; its behavior with files other than ordinary files and directories is unspecified. Most cp implementations use -r as a synonym for -R ; but this behavior isn’t guaranteed
SWITCHES
cp -a
similar to -R ; but it also preserves ownership and copies links as is. The -R option copies the files to which symbolic links point rather than the symbolic links themselves.
–archive
SWITCHES
cp -u
copy the file only if the original is newer than the target or if the target doesn’t exist
–update
SWITCHES
touch -a
change the access time alone; not the modification time
–time=atime
SWITCHES
touch -m
change the modification time alone; not the access time
–time=mtime
SWITCHES
touch -c
don’t create the file if it doesn’t exist
–no-create
SWITCHES
touch -t STRING
ets the time to the value specified by STRING
MMDDhhmm[[CC]YY][.ss]
SWITCHES
tar C
Changes to directory dir before performing operations
- -directory
eg. tar -xvzf bigfile.tar.gz -C /folder/subfolder/
SWITCHES
tar f
Uses the file called file on the computer called host as the archive file
–file [host:]file
SWITCHES
tar g STRING
Performs an incremental backup or restore; using file as a list of previously archived files
–listed- incremental file
SWITCHES
tar M
Creates or extracts a multi-volume archive
–multi- volume
SWITCHES
tar p
Preserves all protection information
–preserve- permissions
SWITCHES
tar P
Retains the leading / on filenames
–absolute- paths
SWITCHES
tar v
Lists all files read or extracted; when used with –list ; displays file sizes; ownership; and time stamps
–verbose
SWITCHES
tar W
Verifies the archive after writing it
–verify
SWITCHES
tar z
Compresses an archive with gzip
–gzip or – ungzip
SWITCHES
tar j
Compresses an archive with bzip2
–bzip2
some older versions used I or y
SWITCHES
tar J
Compresses an archive with xz
–xz
SWITCHES
tar c
Creates an archive
–create
SWITCHES
tar A
Appends tar files to an archive
–concatenate
SWITCHES
tar r
Appends non- tar files to an archive
–append
SWITCHES
tar u
Appends files that are newer than those in an archive
–update
SWITCHES
tar d
Compares an archive to files on disk
–diff or –compare
SWITCHES
tar t
Lists an archive’s contents
–list
SWITCHES
tar x
Extracts files from an archive
–extract or –get
SWITCHES
cpio -o
creates an archive and copies files into it
–create
SWITCHES
cpio -i
extracts data from an existing archive.
–extract
SWITCHES
cpio -p
combines the copy-out and copy-in modes; enabling you to copy a directory tree from one location to another.
–pass-through
SWITCHES
cpio -a
Resets the access time after reading a file so that it doesn’t appear to have been read.
–reset- access-time
SWITCHES
cpio -A
Appends data to an existing archive.
–append
SWITCHES
cpio -E STRING
Uses the contents of filename as a list of files to be extracted in copy-in mode.
–pattern-file=filename
SWITCHES
cpio -F STRING
Uses filename as the cpio archive file; if this parameter is omitted; cpio uses standard input or output.
–file=filename
SWITCHES
cpio -H STRING
Uses a specified format for the archive file. Common values for format include bin (the default; an old binary format); crc (a newer binary format with a checksum); and tar (the format used by tar ).
–format=format
SWITCHES
cpio -I STRING
Uses the filename specified by STRING instead of standard input. (Unlike -F ; this option does not redirect output data.)
SWITCHES
cpio –no-absolute-filenames
In copy-in mode; extracts files relative to the current directory; even if filenames in the archive contain full directory paths.
SWITCHES
cpio -o STRING
Uses the filename specified by STRING instead of standard output. (Unlike -F ; this option does not redirect input data.)
SWITCHES
cpio -t
Displays a table of contents for the input
–list
SWITCHES
cpio -u
Replaces all files without first asking for verification.
–unconditional
SWITCHES
cpio -v
Displays filenames as they’re added to or extracted from the archive. When used with -t ; displays additional listing information (similar to ls -l ).
–verbose
SWITCHES
dd if=STRING
use STRING as the input file
dd if=/dev/sda3 of=/dev/dvd
SWITCHES
dd of=STRING
use STRING as the output file
dd if=/dev/sda3 of=/dev/dvd
SWITCHES
dd bs=NUMBER
read the filesystem using a block size of NUMBER
1024 seems good
SWITCHES
dd count=NUMBER
read count*bs bytes from the input file
SWITCHES
ln -f
overwrite any existing files without prompting
–force
SWITCHES
ln -i
prompt before overwriting
–interactive
SWITCHES
ln -d
attempt to make a hard link to a directory
or -F or –directory
usually fails
SWITCHES
ln -s
make a symbolic link
–symbolic
SWITCHES
mkdir -m STRING
causes the new directory to have the specified permission mode; expressed as an octal number.
–mode=mode
SWITCHES
mkdir -p
create parent directories as needed
–parents
SWITCHES
rmdir –ignore-fail-on-non-empty
don’t display an error message if the directory isn’t empty
SWITCHES
rmdir -p
delete parent directories recursively
- -parents
eg. rmdir -p one/two/three
SWITCHES
chown -R
–recursive
SWITCHES
chmod u
set permissions for the owner
SWITCHES
chmod g
set permissions for the group
SWITCHES
chmod o
set permissions for all others (world)
SWITCHES
chmod a
set permissions for ugo
SWITCHES
chmod +
add permissions
SWITCHES
chmod -
remove permissions
SWITCHES
chmod =
set permissions equal to
SWITCHES
chmod r
read permission
SWITCHES
chmod w
write permission
SWITCHES
chmod x
execute permission
SWITCHES
chmod X
execute permission only if it’s already set
SWITCHES
chmod s
SUID or SGID
SWITCHES
chmod t
sticky bit
SWITCHES
chmod u
existing owner’s permissions
SWITCHES
chmod o
existing other permissions
SWITCHES
umask -S
display permissions that will not be removed from files/folder symbolically
e.g. u=rwx;g=rx;o=rx
SWITCHES
newgrp -l
reinitializes the environment as if the user had just logged in
SWITCHES
chattr [+-]A
Linux won’t update the access time stamp when you access a file. This can reduce disk input/output; which is particularly helpful for saving battery life on laptops.
SWITCHES
chattr [+-]a
disables write access to the file except for appending data.
SWITCHES
chattr [+-]c
causes the kernel to compress data written to the file automatically and uncompress it when it’s read back.
SWITCHES
chattr [+-]i
cannot be modified: it cannot be deleted or renamed; no link can be created to this file and no data can be written to the file.
SWITCHES
chattr [+-]j
tells the kernel to journal all data written to the file. This improves recoverability of data written to the file after a system crash but can slow performance. This flag has no effect on ext2 filesystems.
SWITCHES
chattr [+-]s
when the file is deleted; the kernel zeros its data blocks
SWITCHES
chattr [+-]t
disables this behavior: small data pieces at a file’s end that don’t fill a complete block are merged with similar pieces of data from other files
SWITCHES
quotacheck -c
create aquota.user and aquota.group files
SWITCHES
quotacheck -u
check user quotas
SWITCHES
quotacheck -g
check group quotas
SWITCHES
edquota -t
sets the soft limit grace period
0 disables it
grace periods are per filesystem, not per user
SWITCHES
edquota -g STRING
edit the quota for the group STRING
SWITCHES
quota -g
display group quotas
SWITCHES
quota -l
omits NFS mounts
SWITCHES
quota -q
limits output to filesystems on which usage is over the limit
SWITCHES
find -perm NUMBER
find files that have the specified permissions
also symbolically
e.g. -perm g=w
SWITCHES
find -perm +NUMBER
find files that have any of the specified permission bits set
SWITCHES
find -size NUMBER
locate files that use NUMBER units of space; rounding up NUMBER is specified in 512k blocks trail with c for bytes trail with k for kibibytes trail with M for Mebibytes
SWITCHES
find -size +NUMBER
locate files larger than NUMBER units of space; rounding up
SWITCHES
find -size -NUMBER
locate files less than NUMBER units of space; rounding up
SWITCHES
find -gid NUMBER
locates files whose gid matches GID
SWITCHES
find -group STRING
locate files whose group matches STRING
SWITCHES
find -uid NUMBER
locates files whose uid matches UID
SWITCHES
find -user STRING
locate files whose owner matches STRING
SWITCHES
find -maxdepth NUMBER
only recuse NUMBER directories
SWITCHES
which -a
show all matches
SWITCHES
type -t
shortens the output to builtin ; file ; alias ; or other short identifiers.
SWITCHES
type -a
provides a complete list; for instance; it provides both the alias expansion and the location of the ultimate executable when provided with an alias name.
SWITCHES
chkconfig –list
list the services and their applicable runlevels
SWITCHES
chkconfig –level NUMBER STRING1 STRING2
set the STRING1 program to on or off (STRING2) on the runlevels specified in NUMBER with no delimiters
chkconfig –level 23 nfs-common on
SWITCHES
chkconfig –add STRING
adds the STRING script to those managed by chkconfig
This approach may not work if the script lacks the necessary comment lines with runlevel sequence numbers for chkconfig ‘s benefit
SWITCHES
shutdown now
shutdown now
SWITCHES
shutdown -c
cancel a pending shutdown
SWITCHES
shutdown -r
reboot
SWITCHES
shutdown -H
halt
SWITCHES
shutdown -P
power off
SWITCHES
shutdown -h
usually powers off; may halt
SWITCHES
systemctl list-units
Displays the current status of all configured units.
SWITCHES
systemctl default
Changes to the default target uni
SWITCHES
systemctl isolate
Starts the named unit and stops all others.
systemctl isolate rescue.target
go into single user mode
SWITCHES
systemctl start STRING
Starts the named unit.
SWITCHES
systemctl stop STRING
Stops the named unit.
SWITCHES
systemctl reload STRING
Causes the named unit to reload its configuration file.
SWITCHES
systemctl restart STRING
Causes the named unit to shut down and restart.
SWITCHES
systemctl status STRING
Displays the status of the named unit. (You can pass a PID value; rather than a name; if you like.)
SWITCHES
systemctl enable STRING
Configures the unit to start when the computer next boots.
SWITCHES
systemctl disable STRING
Configures the unit not to start when the computer next boots.
SWITCHES
vi commands while running o
opens a new line immediately below the current line; moves the cursor to that line; and enters insert mode
SWITCHES
vi commands while running #yy
copy # lines
SWITCHES
vi commands while running #dd
cut # lines
SWITCHES
vi commands while running yw
copy from cursor to end of word
SWITCHES
vi commands while running dw
cut from cursor to end of word
SWITCHES
vi commands while running p
paste
SWITCHES
vi commands while running R
enter text replacement mode
SWITCHES
vi commands while running a
enter insert mode and advance the cursor 1 space
SWITCHES
vi commands while running ZZ
:wq
SWITCHES
vi commands while running ~
change case under cursor and advance 1
SWITCHES
vi commands while running u
undo
SWITCHES
vi commands while running o
inserts a new line immediately below the current one and enters insert mode on that line
SWITCHES
vi commands while running /
search forward for text
SWITCHES
vi commands while running ?
search backward for text
SWITCHES
vi commands while running cw
clear from cursor to the end of the word and enter insert mode
SWITCHES
vi commands while running cc
clear line and enter insert mode
SWITCHES
vi commands while running #G
go to line #
SWITCHES
vi commands while running H
move cursor to top of screen
SWITCHES
vi commands while running L
move cursor to bottom of screen
SWITCHES
vi commands while running :%s/STRING1/STRING2/g
replace STRING1 with STRING2 globally
remove g to do the first occurance on each line
to do only lines 3 through 5; replace % with 3,5
SWITCHES
vi commands while running :e STRING
load file STRING for editing
closes the currently open file
SWITCHES
vi commands while running :r STRING
load file STRING on the line after the cursor
SWITCHES
vi commands while running :!STRING
run external command STRING
:!ls runs ls ; enabling you to see what files are present in the current directory
LOCATIONS
the bash history
~/.bash_history
LOCATIONS
rpm main configuration file
/usr/lib/rpm/rpmrc
typically you don’t edit this file
LOCATIONS
rpm global configuration file for editing
/etc/rpmrc
create it if it doesn’t exist
The main reason to create such a file is to implement architecture optimizations—for instance; to optimize your code for your CPU model by passing appropriate compiler options when you build a source RPM into a binary RPM. This is done with the optflags line:
optflags: athlon -O2 -g -march=i686
LOCATIONS
rpm per user configuration file for editing
∼ /.rpmrc
create it if it doesn’t exist
The main reason to create such a file is to implement architecture optimizations—for instance; to optimize your code for your CPU model by passing appropriate compiler options when you build a source RPM into a binary RPM. This is done with the optflags line:
optflags: athlon -O2 -g -march=i686
LOCATIONS
yum configuration file
/etc/yum.conf
holds basic options; such as the directory to which Yum downloads RPMs and where Yum logs its activities. Chances are that you won’t need to modify this file
LOCATIONS
yum additional configuration files
/etc/yum.repos.d/
You probably shouldn’t directly edit these files; instead; if you want to add a repository; you should manually download the RPM that includes the repository configuration and install it using rpm . The next time you use Yum; it will access your new repository along with the old ones
LOCATIONS
apt repository configuration
/etc/apt/sources.list
okay to modify
LOCATIONS
The main configuration file for dpkg
/etc/dpkg/dpkg.cfg or ∼/.dpkg.cfg
LOCATIONS
controls apt and dselect options
/etc/apt/apt.conf
BIND formatting
LOCATIONS
the debian installed file database
/var/lib/dpkg
LOCATIONS
library path
/etc/ld.so.conf
Generally speaking; there’s seldom a need to change the library path system wide
LOCATIONS
trusted library directories
/lib and /usr/lib
These directories are always on the library path; even if they aren’t listed in ld.so.conf .
LOCATIONS
shared library cache
/etc/ld.so.cache
LOCATIONS
interrupts
/proc/interrupts
virtual filesystem
only shows an entry after a driver that uses the interrupt is loaded
LOCATIONS
Windows name COM1, IRQ 4
/dev/ttyS0
LOCATIONS
Windows name COM2; IRQ 3
/dev/ttyS1
LOCATIONS
Windows name COM3; IRQ 4
/dev/ttyS2
LOCATIONS
Windows name COM4; IRQ 3
/dev/ttyS3
LOCATIONS
Windows name LPT1; IRQ 7
/dev/lp0
LOCATIONS
Windows name LPT2; IRQ 5
/dev/lp1
LOCATIONS
Windows name A:; IRQ 6
/dev/fd0
LOCATIONS
Windows name B:; IRQ 6
/dev/fd1
LOCATIONS
what I/O addresses the computer is using
/proc/ioports
LOCATIONS
what DMA channels your system uses
/proc/dma
LOCATIONS
sysfs virtual filesystem, contains information about devices so that user-space utilities can access the information
/sys
LOCATIONS
a place where dynamic device files as drivers are loaded and unloaded; necessitated by hotplug devices
/dev
LOCATIONS kernel module files; kernel drivers for hardware
/lib/modules
LOCATIONS
currently loaded kernel modules
/proc/modules
LOCATIONS
modprobe configuration
/etc/modprobe.conf
or
/etc/modprobe.d/
LOCATIONS
connected usb devices
/proc/bus/usb
LOCATIONS
where logical volumes for LVM are mapped to names
/dev/mapper
LOCATIONS
Serves as an adjunct to system RAM. It is slow but enables the computer to run more or larger programs.
swap partition (mounted with swapon to /swap)
LOCATIONS
Holds users’ data files. Isolating it on a separate partition preserves user data during a system upgrade. Size depends on the number of users and their data storage needs.
/home partition
LOCATIONS
Holds critical boot files. Creating it as a separate partition lets you circumvent limitations of older BIOSs and boot loaders; which often can’t boot a kernel from a point above a value between 504MiB and 2TiB.
/boot partition
LOCATIONS
Holds most Linux program and data files; this is sometimes the largest partition; although /home is larger on systems with many users or if users store large data files. Changes implemented in 2012 are making it harder to create a separate /usr partition in many distributions
/usr partition
LOCATIONS
Holds Linux program and data files that are unique to this installation; particularly those that you compile yourself
/usr/local partition
LOCATIONS
Holds Linux program and data files that are associated with third- party packages; especially commercial ones
/opt partition
LOCATIONS
Holds miscellaneous files associated with the day-to-day functioning of a computer. These files are often transient in nature. Most often split off as a separate partition when the system functions as a server that uses the /var directory for server-related files like mail queues.
/var partition
LOCATIONS
Holds temporary files created by ordinary users.
/tmp partition
LOCATIONS
Not a separate partition; rather; it or its subdirectories are used as mount points for removable media like CDs and DVDs.
/mnt partition
LOCATIONS
Holds subdirectories that may be used as mount points for removable media; much like /mnt or its subdirectories.
/media partition
LOCATIONS
the partitions that are mounted on boot and their mount points
/etc/fstab
LOCATIONS
a list of filesystems linux has mounted; don’t edit it
/etc/mtab
LOCATIONS
root directory
/
LOCATIONS
contains static and unshareable files related to the computer’s initial booting. Higher-level startup and configuration files reside in another directory; /etc . In this directory; you will find GRUB or LILO configuration files along with the other files necessary for the initial boot. typically; it is recommended that you store /boot on its own partition.
/boot
LOCATIONS
contains unshareable and static system configuration files. These higher-level startup and configuration files control the various programs and services offered on a system
If the Linux distribution uses SysV system initialization; its configuration files are stored here
/etc
LOCATIONS
contains certain critical executable files; such as ls ; cp ; and mount . These commands are accessible to all users and constitute the most important commands that ordinary users might issue
static files; almost never shared
/bin
LOCATIONS
similar to /bin ; but it contains programs that are normally run only by the system administrator—tools like fdisk and e2fsck . It’s static and theoretically shareable; but in practice it makes no sense to share it
/sbin
LOCATIONS
similar to /bin and /sbin ; but it contains program libraries. Program libraries consist of code that’s shared across many programs and stored in separate files to save disk space and RAM.
is static and theoretically shareable; although it’s not shared in practice
/lib
LOCATIONS
hosts the bulk of a Linux computer’s programs. Its contents are shareable and static; so it can be mounted read-only and may be shared with other Linux systems. For these reasons; many administrators split /usr off into a separate partition; although doing so isn’t required
/usr
LOCATIONS
mirror the organization of /usr
osts files that a system administrator installs locally—for instance; packages that are compiled on the target computer. The idea is to have an area that’s safe from automatic software upgrades when the OS as a whole is upgraded.
Some system administrators split this off into its own partition to protect it from OS reinstallation procedures that might erase the parent partition.
/usr/local
LOCATIONS
stores the manual pages used by the man command
/usr/share/man
LOCATIONS
houses files related to the X Window System (X for short); Linux’s GUI environment.
often moved to /usr/bin
/usr/X11R6
LOCATIONS
intended for ready-made packages that don’t ship with the OS; such as commercial word processors or games.
static and shareable
Some system administrators break it into a separate partition
/opt
LOCATIONS
contains users’ data; and it’s shareable and variable
/home
LOCATIONS
home directory of the root user
variable; not shareable
/root
LOCATIONS
contains transient files of various types—system log files; print spool files; mail and news files; and so on
variable; some subfolders are shareable and some are not
Many system administrators put /var in its own partition; particularly on systems that see a lot of activity in /var ; like major Usenet news or mail servers.
/var
LOCATIONS
temporary files
variable; seldom shared
/tmp
LOCATIONS
removable-media devices
/mnt
LOCATIONS
like /mnt ; but it should contain subdirectories for specific media types
/media
LOCATIONS
files that represent devices
/dev
LOCATIONS
virtual filesystem that’s created dynamically by Linux to provide access to certain types of hardware information that aren’t accessible via /dev
/proc
LOCATIONS
the configuration file for updatedb used by locate
/etc/updatedb.conf
LOCATIONS
EFI System Partition (ESP)
/boot/efi
LOCATIONS
grub legacy configuration file
/boot/grub/menu.lst
/boot/grub/grub.conf
LOCATIONS
grub 2 configuration file
/boot/grub/grub.cfg
do not edit
LOCATIONS
grub 2 OS probers
etc/grub.d/
LOCATIONS
grub 2 menu configuration
/etc/default/grub
LOCATIONS
syslogd output
/var/log/messages
LOCATIONS
i think this is also syslogd output
/var/log/syslog
LOCATIONS
the first program run by the kernel
/sbin/init
LOCATIONS
the programs the init script is supposed to run when changing runlevels
also specifies the default runlevel
/etc/inittab
id: runlevels:action:process
e. g.
l0: 0:wait:/etc/init.d/rc 0
l1: 1:wait:/etc/init.d/rc 1
LOCATIONS
the program that runs all of the scripts associated with the desired runlevel
/etc/init.d/rc
or /etc/rc.d/rc
LOCATIONS
scripts that are run by rc when the runlevel changes
/etc/rc.d/rc?.d
or /etc/init.d/rc?.d or /etc/rc?.d
S* scripts are started
K* scripts are stopped
LOCATIONS
configuration files for systemd
/lib/systemd/system
LOCATIONS
Upstart and it’s scripts
/etc/init/