• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/352

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

352 Cards in this Set

  • Front
  • Back
$?
Shell var for exit status of last command.
echo $? ... 0
Exit status of true. Last shell cmd succeeded.
echo $? ... 1
Exits status of false. Last shell cmd failed.
echo $? … greater than 1
Exit status greater than 1 is an error code.
echo $? ... 127
Error: Cmd invalid / not found
echo $?
Output exit status of last cmd.
> /dev/null
Discard stdout by redirecting to /dev/null
2> /dev/null
Discard stderr by redirecting to /dev/null
stdin
Standard input
stdout
Standard output
stderr
Standard error
true; echo $? … 0
Explicitly set exit status to true
false; echo $? … 1
Explicitly set exit status to false
cmd1; cmd2
Semi-colon cmd delimiter: independent series of cmds
cmd1 | cmd2
Pipe cmd delimiter: transfers cmd1 stdout to cmd2 stdin
cmd1 && cmd2
Cmd delimiter: exec cmd2 only if cmd1 exits 0/success
cmd1 || cmd2
Cmd delimiter: exec cmd2 only if cmd1 exits 1/failure
cmd1 && { cmd2; cmd3 }
Braces statement delimiter: group cmds for conditional exec
$PATH
User's search paths for cmd line cmds
$MANPATH
User's search paths for man pages
#
Comment indicator. Ignore everything else on line.
#! /bin/bash
First line of shell script. Sets shell for script.
` cmd `
Cmd substitution backticks. End result of contained cmds returned.
$( cmd )
Cmd substitution $( ). End result of contained cmds returend.
[ ]
Brackets. Contain a condition to test
"[ ""str1"" = ""str2"" ]"
Test for string equality
"[ ""str1"" != ""str2"" ]"
Test for string inequality
[ -f file ]
Test if file is a file
[ -r file ]
Test if file is readable
[ -w file ]
Test if file is writable
[ -x file ]
Test if file is executable
[ -d file ]
Test if file is a dir
[ -s file ]
Test if file is non-empty
[ -L file ]
Test if file is a symbolic link
sh
Start a Bourne Shell
csh
Start a C Shell
ksh
Start a Korn Shell
bash
Start a Bourne Again Shell
\n
Newline
\t
Tab
\c
Continue on the same line (suppress next \n)
\a
Alert bell
$SHELL
the default shell
$HOME
default or home dir
$PWD
the current dir
$MAIL
default mail dir
$PS1
default primary prompt symbol
$PS2
default secondary prompt symbol
LOGNAME
User's login username
$EDITOR
the default editor
$TERM
terminal emulation for current session
$LINES
default number of lines per screen
$TZ
time zones and hours from Greenwich time
ftp some.server.tld
Open ftp connection to some.server.tld
ftp$ get file
Download file from current remote dir to current local dir
passwd
Interactive cmd for user to change password
passwd -F file
Change password and store in alternate password file
command [ [ -option [optionArgument] ] … [cmdArg]
Unix command format
vi file
Interactive text editor
uname
Displays the Unix family of the OS
ssh some.server.tld
Open a command line session to another server
ssh -l name some.server.tld
Connect via ssh to a server with username 'name'
hostname
Display hostname of server (hills.ccsf.edu = hills)
date
Display server date and time
cal
Display mini calendar for the current month
cal 8 1969
Display calendar for August 1969
date -u +%d
Show two-digit day of the month 01-31
date -u +%m
Show two-digit month 01-12
date -u +%Y
Show year with century 2009
uptime
Show how long system has been up and running
uptime -w
"Who is logged in, when, idle time, last cmd"
w
"Alisa for uptime -w; Who is logged in, when, idle time, last cmd"
who
Who is logged in and when
whoami
User logged in to current session
who -H
"Run who with a header: NAME, LINE, TIME"
finger
Detailed info on users logged in
finger username
Detailed info on 'username'
id
"Show current user id, group id, and group memberships"
> file
Cmd delimiter: redirect stdout to file and clobber
>> file
Cmd delimiter: redirect stdout to file and append
2> file
Cmd delimiter: redirect stderr to file and clobber
2>> file
Cmd delimiter: redirect stderr to file and append
< file
Cmd delimiter: redirect stdin from file to cmd
echo -n 'some text'
Suppress echo's automatic line break after output
ech 'blah' 1> fileA 2> fileb
"Place cmd stdout in fileA, error msg in fileB, no cmd line output"
ech 'blah' 1> fileA 2>&1
"Place cmd stdout in fileA, redirect error msg to stdout"
cat file1 file2 … fileN
"Open, concatenate, and display file1 thru fileN"
$?
Shell var for exit status of last command.
echo $? ... 0
Exit status of true. Last shell cmd succeeded.
echo $? ... 1
Exits status of false. Last shell cmd failed.
echo $? … greater than 1
Exit status greater than 1 is an error code.
echo $? ... 127
Error: Cmd invalid / not found
echo $?
Output exit status of last cmd.
> /dev/null
Discard stdout by redirecting to /dev/null
2> /dev/null
Discard stderr by redirecting to /dev/null
stdin
Standard input
stdout
Standard output
stderr
Standard error
true; echo $? … 0
Explicitly set exit status to true
false; echo $? … 1
Explicitly set exit status to false
cmd1; cmd2
Semi-colon cmd delimiter: independent series of cmds
cmd1 | cmd2
Pipe cmd delimiter: transfers cmd1 stdout to cmd2 stdin
cmd1 && cmd2
Cmd delimiter: exec cmd2 only if cmd1 exits 0/success
cmd1 || cmd2
Cmd delimiter: exec cmd2 only if cmd1 exits 1/failure
cmd1 && { cmd2; cmd3 }
Braces statement delimiter: group cmds for conditional exec
$PATH
User's search paths for cmd line cmds
$MANPATH
User's search paths for man pages
#
Comment indicator. Ignore everything else on line.
#! /bin/bash
First line of shell script. Sets shell for script.
` cmd `
Cmd substitution backticks. End result of contained cmds returned.
$( cmd )
Cmd substitution $( ). End result of contained cmds returend.
[ ]
Brackets. Contain a condition to test
"[ ""str1"" = ""str2"" ]"
Test for string equality
"[ ""str1"" != ""str2"" ]"
Test for string inequality
[ -f file ]
Test if file is a file
[ -r file ]
Test if file is readable
[ -w file ]
Test if file is writable
[ -x file ]
Test if file is executable
[ -d file ]
Test if file is a dir
[ -s file ]
Test if file is non-empty
[ -L file ]
Test if file is a symbolic link
sh
Start a Bourne Shell
csh
Start a C Shell
ksh
Start a Korn Shell
bash
Start a Bourne Again Shell
\n
Newline
\t
Tab
\c
Continue on the same line (suppress next \n)
\a
Alert bell
$SHELL
the default shell
$HOME
default or home dir
$PWD
the current dir
$MAIL
default mail dir
$PS1
default primary prompt symbol
$PS2
default secondary prompt symbol
LOGNAME
User's login username
$EDITOR
the default editor
$TERM
terminal emulation for current session
$LINES
default number of lines per screen
$TZ
time zones and hours from Greenwich time
ftp some.server.tld
Open ftp connection to some.server.tld
ftp$ get file
Download file from current remote dir to current local dir
passwd
Interactive cmd for user to change password
passwd -F file
Change password and store in alternate password file
command [ [ -option [optionArgument] ] … [cmdArg]
Unix command format
vi file
Interactive text editor
uname
Displays the Unix family of the OS
ssh some.server.tld
Open a command line session to another server
ssh -l name some.server.tld
Connect via ssh to a server with username 'name'
hostname
Display hostname of server (hills.ccsf.edu = hills)
date
Display server date and time
cal
Display mini calendar for the current month
cal 8 1969
Display calendar for August 1969
date -u +%d
Show two-digit day of the month 01-31
date -u +%m
Show two-digit month 01-12
date -u +%Y
Show year with century 2009
uptime
Show how long system has been up and running
uptime -w
"Who is logged in, when, idle time, last cmd"
w
"Alisa for uptime -w; Who is logged in, when, idle time, last cmd"
who
Who is logged in and when
whoami
User logged in to current session
who -H
"Run who with a header: NAME, LINE, TIME"
finger
Detailed info on users logged in
finger username
Detailed info on 'username'
id
"Show current user id, group id, and group memberships"
> file
Cmd delimiter: redirect stdout to file and clobber
>> file
Cmd delimiter: redirect stdout to file and append
2> file
Cmd delimiter: redirect stderr to file and clobber
2>> file
Cmd delimiter: redirect stderr to file and append
< file
Cmd delimiter: redirect stdin from file to cmd
echo -n 'some text'
Suppress echo's automatic line break after output
ech 'blah' 1> fileA 2> fileb
"Place cmd stdout in fileA, error msg in fileB, no cmd line output"
ech 'blah' 1> fileA 2>&1
"Place cmd stdout in fileA, redirect error msg to stdout"
cat file1 file2 … fileN
"Open, concatenate, and display file1 thru fileN"
cat -n file
Display file with line numbers
cat -s file
Suppress error msgs about non-existent files
history
Displays the last 500 (?) cmd line cmds
!N
Repeat cmd N in history list (bash)
!!
Repeat very last cmd
!abbrev
Repeat last cmd that matches 'abbrev'
rN
Repeat cmd N in history list (K shell)
exit
Log off session; stop capturing with script cmd
script
Begin capturing to file typescript
script file
Begin capturing to file
touch file
"Update access, modification, and last change time of file, create file if not exist"
touch -a file
Update access time of file to current time
touch -m file
Update modification time of file to current time
touch -m file -t time
Update modification time of file to specified time
touch -c file
"Update file, but don't create file if it doesn't exist"
paste file1 file2
"Output file1 and file2 with respective lines merged together (ie, into columns)"
cut -c2-5 file
"Cut columns 2-5 from file, col = char"
cut -2- file
Cut columns 2 to last col from file
cut -f2-2 -d ':' file
"Cut colums 2-3, delimited by :"
"cut -f 2-3,6 -d ':' file"
"Cut colums 2-3 and 6, delimited by :"
lp -d printerid file
Print file on printer 'printerid'
pr file
Print file to stdout with default pagination
pr -l30
Print file to stdout with 30 lines per page
pr -2 file
Print file to stdout in 2 columns
pr -n file
"Print file to stdout w/ sequential line #s, increment/line/col"
pr -l30 -2 -n file | lp -d printer
"Print file on 'printer' @ 30 lines & two cols / pg, numbered lines"
pr -e
Expand tabs to character positions
vi file
Open file in vi text editor
vi: :w
Save file and keep editing in vi
vi: :wq
Save file and quit in vi
vi: :q!
Quit without saving in vi
vi: :e
Save file as another file with a new name in vi
vi :r file
Read in file at cursor in vi
vi: :!anyunixcmd
Run any unix cmd without exiting to shell in vi
vi: /pattern
Find next line matching 'pattern' in vi
vi: :%s/old/new/g
Search for and replace all instances of old with new in vi
/
Unix root dir
ps
ps
cd
Change to user's home dir
cd ../
Change to the next higher dir
cd dir
Change directory to dir
mv file1 file2
"Rename file1 to file2, clobber file2 if exists"
mv fileordir1 … fileordirN dir
Move 1+ files or dirs into dir
mv dir1 dir2
"Rename dir1 to dir2, or move dir1 into 2 if 2 exists"
clobber
Term meaning to overwrite the file without warning if it already exists
cp file1 file2
"Copy file1 to file2, create or clobber file2"
cp file1 … file2 dir
Copy files into a dir
cp -R dir1 dir2
Copy dir1 and all contents to dir2; Make dir2 if not exist and put dir1 contents in it
cp -R dir1 … dirN dir2
Copy one or more dirs and contents into existing dir2
ln file1 link1
"Create a hard link, link1, to file1"
ln -s file1 link1
"Create a symbolic link, link1, to file1"
symbolic link
A reference pointing to another file
hard link
A reference pointing to a file on disk; multiple pointers possible
explain error 'bash[2]; nosuchcmd: cmd not found'
"First ps name, then [line of file], then attempted cdm, then error"
mkdir name
Make a new dir called name
mkdir -p path/to/dir
Make all dirs needed to create path/to/dir
rmdir dir
Remove a dir if dir is empty
rm file
Delete a file
rm -R
Delete a dir and all child dirs
ls [dir]
List of visible files
ls -a [dir]
List of all visible and hidden files
ls -l [dir]
"Long listing of files, including hidden, with all attributes"
ll [dir]
Alias for long listing of files with all attributes
ls -d [dir]
Status of current directory
ls -t [dir]
List files in dir sorted by modified date
ls -R [dir]
List contents of dir and subdirs
ugoa
"user, group, other, all"
rwx
read write execute
chmod {ugoa} {+-=} {rwx} file(s)
Cmd to change file permissions
chgrp group file
Change group of file to group
umask
umask
chown user file
Change owner of file to user if you own it
d---------
File is a directory
l---------
File is a symbolic link
file1 -> file2
File1 is a symbolic link to file2
-rwx------ me mygroup file
File is rwx for user
----r-x--- me mygroup file
File is r-x for group
-------r--- me mygroup file
File is readable by everyone
-r--rwx--- me mygroup file
I can only read file b/c my user perms override mygroup perms
----rwx--- me mygroup file
I can rwx file b/c mygroup has rwx to the file
binary rwx
Permission 7
binary rw-
Permission 6
binary --x
Permission 1
binary r--
Permission 4
binary -w-
Permission 2
binary r-x
Permission 5
binary ---
Permission 0
wildcard: *
"Match any single char in filename, incl no chars"
wildcard: ?
Match any single char in filename
wildcard: […]
Match a char or range of chars in filename
wildcard: !
Match anything except x in filename
wildcard: [!a-z]
Match anything except lowecase letters in filename
wildcard: \
Disable special char meaning in filename substitution
wildcard: \*
Match a literal * in filename
wildcard: [[:alpha:]]
Match any alphabetical character by class
wildcard: [[:digit:]]
Match any digit by class
wildcard: [[:upper:]]
Match any upper case letter by class
wildcard: [[:lower:]]
Match any lower case letter by class
wildcard: [[:alnum:]]
Match any alphanumeric char by class
wildcard: [[:blank:]]
Match any blank by class
wildcard: [[:space:]]
Match any whitespace char by class
wildcard: [[:punct:]]
Match any punctuation by class
ls -i [dir]
Show inode numbers in file listing
ls -F [dir]
"After each file: / for dir, * for exec, @ symlnk, | fifo"
ls -L [dir]
Hide link indicators for files
ls -R [dir]
Recursivley list subdirs of dir
ls -ld dir
Examine permissions of a dir
ls -lc fileordir
Show date of last file mod
ls -lu fileordir
Show date of last file access
tr ':/' ' _'
Translate : to ' ' and '/' to '_'
wc file
"Count lines, words, chars in file"
wc -l file
Count lines in file
wc -w file
Count words in file
wc -c file
Count chars in file
sort file
Sort file alphabetically starting with first char
sort -n file
Sort file numerically
sort -u file
Sort and remove duplicates
sort -f file
Sort case-insensitively
sort -M file
Sort by month of the year
sort +1 file
"Sort on the second column (first offset), space delim"
sort +1.2 file
"Sort starting on the 3rd offset char of second field, space delim"
sort -b file
Treat multiple spaces as a single space delim in sort
sort -nb +3 -3.2 +0
"Num sort on space delim col 4 (char 1-3), then col 1"
regex: .
Match any char
regex: ^
Match beginning of line
regex: $
Match eol
regex: *
Match zero+ of prev char
regex: +
Match 1+ of prev char
regex: [chars]
Match any char in chars
regex: [^chars]
Match any char not in chars
regex: [a-zA-Z]
Match any upper or lower case letter
"regex: \{min,max\}"
"Match prev occurrence at least min, at most max times"
sed 's/old_pattern/new_pattern/g' file
Substitute all occurrences of old with new in file (stream)
"find dir -name ""pattern"""
Find all files/dirs named pattern under dir
"find /students -name ""bin"""
Find all files/dirs named bin under /students
find dir -perm 755
Find files with permissions 755
find dir -mtime +30
Find files with modified time more than 30 days ago
find dir -size +5
Find all files bigger than 5 (512 byte) blocks
find dir -size -5c
Find all files smaller than 5 chars in size
find dir -type f
Find all files of type file
find dir -type d
Find all files of type dir
find dir -type l
Find all files of type symbolic link
find dir -user user
Find all files owned by user
find dir -group group
Find all files owned by group
grep pattern file1 … fileN
Search for pattern in file(s) and display found lines
grep -i pattern file1 … fileN
Case-insensitive grep
grep -v pattern file1 … fileN
Search for pattern in file(s) and display lines that don't match
grep -n pattern file1 … fileN
Number grep's found lines
grep -E regex_pattern file1 … fileN
Match extended regex chars in grep pattern
grep -f pattern file1 … fileN
Suppress printing of filenames when grepping multiple files
man cmd
Display first found man page for cmd
man -k cmd
Display 1-line descs of man pgs w/ keyword in desc
man -M path:path
Change the search path for man pages
man 3 ls
Search for ls man pages in manual 3
/dev
Device driver dir
sftp user@host
Open secure ftp connection to host
ftp: lcd
Change local dir while in ftp connection
ftp: lpwd
Print local pwd while in ftp connection
scp localpath user@host:path
FTP a file in a single cmd to a path relative to HOME on remote server
scp localpath user@host:/path
FTP a file in a single cmd to an absolute path on a remote server
scp -r localpath user@host:path
FTP all files in dir w/ single cmd to remote server
xargs -I rm -F {}\;
xargs
umask 421
"Deny new files u=r, g=w, o=x"
umask 007
Deny new files o=rwx
umask 0
Use server default perms for new files and dirs
uniq file
Remove duplicate consecutive lines from input
uniq -u file
Print only the lines not repeated in original file
tar -cfv archive file1 … fileN
Create an archive of files/dir
tar -xvf archive
Extract files from an archive
gzip file
Compress file to gz
gunzip file
Uncompress a .gz file
for f in *; do ls -l f; done
Loop
"if [ -f ""file"" ]; then cp ""file"" ""file.bak""; fi"
If test
/usr/share/man
Standard path for man pages
mode #lnks owner group bytesize mod_time file
ls -l columns
touch -a -t 0309211200 file
Update access time of file to 9/21/03 noon
touch -m -t 0309211200 file
Update access time of file to 9/21/03 noon
touch -t 0309211200 file
Specify timestamp of file as 9/21/03 noon