Linux essentials Flashcards
tar -tvf
t = list v = verbose, f=filename
tar -z
compressed file with gzip
tar -c
create a tar file
ls -l
list files long (extra info
ls -h
list files, human readable
tar -xvf
extract files, verbose, file name
tar -r
add to existing archive
cp
copy
gzip
zips file, replaces old one
gzip -r
-r is recursive (subdirectories)
tar -j
compresses with bzip2
tar -t
list contents of the archive
tar -z
compresses with zip
stderr
Standard error (stderr) occurs when an error appears during the execution of a command; it has a file descriptor of 2. Error messages are also sent to the terminal window by default.
stdin
Standard input, stdin, usually is provided by you to a command by typing on the keyboard; it has a file descriptor of 0. However, by redirecting standard input, files can also be used as stdin.
stdout
stdout. The file descriptor number for this channel is 1.
tr
the tr command translates characters, but it only accepts data from stdin, never from a file name given as an argument. This is great when you want to do something like capitalize data that is inputted from the keyboard
more
pipeable/redirect command to do more of a long command
cut
The cut command is useful for extracting fields from files that are either delimited by a character, like the colon : in /etc/passwd, or that have a fixed width
head
top 10 lines of a file/dir
tails
last 10 lines of a file/dir
head -2
first two lines of that dir
head -n -#
head command is to use the option -n -#, where # is the number of lines counted from the bottom of the output to exclude. Notice the minus symbol - in front of the #
grep -e
The -E option to the grep command can be used to perform searches with extended regular expressions, essentially more powerful regular expressions. Another way to use extended regular expressions is to use the egrep command.
fgrep
The fgrep command is used to match literal characters, ignoring the special meaning of regular expression characters.
grep ‘^###’
Only files with beginning in ### will show
grep ‘###’
Searches for ### anywhere in a line
grep ###
Greedy, matches with anything with ### in it
grep ‘###$’
searches for ### at the end of a line
grep ‘.y’
Use the period character . to match any single character. For example, execute the following command to match any character followed by a ‘y’
egrep ###|###
the | in egrep acts as an “or” statement
in egrep is used as an “or”
egrep ‘no(b|n)’
() acts as a scope for |, searching for nob or non