Common Commands and Utilities

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

COMMON COMMANDS AND

UTILITIES
COMMANDS YOU SHOULD KNOW

• chown/chmod/mkdir/cd/grep
• cd /rm/echo/cat/ls/ln/man
•| > >> < <<
• grep/more/less
MAN
MAN(1) Manual pager utils MAN(1)

NAME
man - an interface to the on-line reference manuals

SYNOPSIS
man [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L
locale] [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I]
[--regex|--wildcard] [--names-only] [-a] [-u] [--no-subpages] [-P
pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation] [-p string]
[-t] [-T[device]] [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ...
man -k [apropos options] regexp ...
man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
man -f [whatis options] page ...
man -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L
locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t]
[-T[device]] [-H[browser]] [-X[dpi]] [-Z] file ...
man -w|-W [-C file] [-d] [-D] page ...
man -c [-C file] [-d] [-D] page ...
man [-hV]
PROCESS CONTROL AND MONITORING

• ps – list processes
• pstree -Au
• List out processes and relationships
• kill/killall
• top – used to monitor processes and system usage
NICE AND RENICE

• nice – allows us to specify the priority of a task being started


• renice – allows us to specify the priority of a task already started

• Allowable range -20 to +19 with default value of 0


• nice -n [+/-#] [CMD]
/PROC DIRECTORY

• A set of files that represent the state of the kernel.

• Great for find info about the system and how its currently configured.
FILE SYSTEMS

• What is a file system?


• What does a file system need to do?
FILE SYSTEMS

• What is a file system?


• Responsible for managing the files on a device.
• What does a file system need to do?
• Keep track of where the file is
• File Length
• Ownership
• File name
• File path
• File type (block, character, directory, etc.)
FILE SYSTEM TYPES

• ext2
• ext3 – ext2 w/ Journaling
• ext4
• resierfs
• FAT/FAT32/NTFS
• ISO 9660

• Can use df -T to determine mounted file systems and their types.


PARTITION
• Why do we want partitions?
• First step: fdisk
sda (physical hard disk)

mbr sda1 /boot sda2 /var sda3 /

• What does fdisk do?


• fdisk –l

• Windows:
\Device\Harddisk0\ (physical hard disk)

mbr \Device\Harddisk0\Partition0 C:\


PARTITION
• Now we format!
• Does format wipe all of our data?
sda (physical hard disk)

mbr sda1 /boot sda2 /var sda3 /

• mkfs.ext3 /dev/sda2
• What does this do: mkfs.ext3 /dev/sda
• Is it valid?
• Windows corollary: format c:
• FORMAT volume /FS:filesystem …
FILE SYSTEM NAVIGATION
/bin – system binary executables /opt – optional install dir
/boot – kernel and boot files /proc
/dev – system devices /root – home dir for root (optional)
/etc – startup and config files /sbin – binaries for su
/home – home dir for users /selinux
/lib – shared libraries (think dll) /sys
/media – mount for removable media /tmp – temporary files (wiped on restart)
/mnt - mount /usr – typical installed programs, man
pages, local files, etc.
/var – logging, pids, mail

/usr /var
--/bin – binary executables --/log
--/include --/mail
--/lib --/opt
--/local – local version of /usr --/run – pids
--/sbin – binary executables for su --/spool – spools printers, mail, etc.
--/share --/tmp – non volatile temp
--/src – shared source code (kernel, etc.)
FILE TYPES

• Regular Files
• Directory
• Character device file
• Block device file
• Local domain socket
• Named pipe
• Symbolic Link
MOUNT

• mounts a device to a folder to allow access

• mount -t ext2 /dev/hda2 /boot

• mount -t ntfs /dev/hdb1 /mnt/win/


• /mnt/win/Users/Mike/Desktop/rickroll.avi

• mount /media/cdrom

You might also like