Basic Commands Flashcards
Runlevel
-determines which level machine is running on
Init 0-6
-whole server action
0 - Halt (sleep mode) 1 - Single-user mode (safe) 2 - Multi-user mode w/out networking $3 - Multi-user mode w/ networking$ 4 - NO FUNCTION 5 - Graphic User Interface (GUI) 6 - Reboot
Chkconfig
- sees all services running
- Chkconfig (service) on/off (turns service on/off at startup)
- Chkconfig | grep service (checks particular run levels of service)
- Chkconfig –level (run level[s]) on/off (turns particular run levels on/off for selected service)
Fg
-brings the most recent job to foreground
bg
-lists stopped or background jobs; resumes a stopped job in the background
Ln -s FILE LINK
-create a symbolic LINK to FILE
Pwd
-show current directory
Ls -al
-formatted listings w/ hidden files
gzip -d FILE.gz
-decompressed FILE.gz back to FILE
Ctrl +r
-bring up a recent command
Ctrl +u
-erases the whole line
Ctrl +w
-erases one word in the current line
Ctrl +d
-log out of current session (like “exit” command)
Ctrl +c
-halts the current command
Ctrl +l
Clear
-erase all
More FILE
-output the contents of FILE
!!
-repeats the last command
Ssh-copy-id USER@HOST
-add your key to HOST for USER to enable a keyed or password-less login
W
-display who is online
Finger USER
-display information about USER
Uname -a
-show kernel information
Tar czf FILE.TAR.GZ FILE
-create a tar with Gzip compression
Tar xzf FILE.TAR.GZ
-extract a tar using Gzip
Du
-show directory space usage
Du -sh
-shows usage for CURRENT directory
Whereis APP
-shows possible location of APP
Which APP
-show which app will be run by default
Grep -r PATTERN DIR
-search reclusively for PATTERN in DIR
Fg n
-brings jobs n to the background
COMMAND | grep PATTERN
-search for PATTERN in the output of COMMAND
Locate FILE
-find all instances of FILE
Ssh -p PORT USER@HOST
-connect to HOST on port PORT as USER
Ssh USER@HOST
-connect to HOST as USER
Date
-shows current date and time
Uptime
-show current uptime
Whoami
-who you are logged in as
Man COMMAND
-shows the manual for COMMAND
Dig DOMAIN
-get DNS information for DOMAIN
Dig -x HOST
-reverse lookup HOST
Wget -c FILE
-continue a stopped download
Make install
./configure
Make
-install from source
Dpkg -i PKG.DEB
-install a package (Debian)
Cat > FILE
-places standard input into FILE
Ps
-display your current active process
Top
-display all running processes
Whois DOMAIN
-gets Whois information for DOMAIN
Killall PROC
-kill all processes named PROC
Kill pid
-kill process id PID
Tail -f FILE
-output the contents of a file as it grows, STARTING WITH LAST 10 LINES
Head FILE
-output the first 10 lines of FILE
Tail FILE
-output the last 10 lines of FILE