Domain 2 Flashcards
cat -b
Adds line numbers
free
Shows available memory
type program-name
Will show programs directory
Ctrl z
Suspends running program
Bg and fg
Sends a program to background or foreground.
Can also use & e.g. blender&
Command history stuff
Ctrl a = beginning of line
Ctrl e = end of line
Delete key = del highlighted char
Ctrl t = move char on the left over one to the right
Search man pages
whatis
Man -k
Apropos
How to quit less
Q, :q or zz
Moving in less
Space bar = down
B = up
Wrap a command in terminal
\
Linked pages in info
Called nodes
find
Find - can search dir for a document that contains a string
find /usr/share/docs -name “password”
whereis
Used for finding files in root directories not user directories
locate
Searches database of file names
Shareable verses unshareable files FHS
Nonshareable files contain system specific information such as config files
shareable files containing data or program binary files
/
The root directory
/etc
System configuration files
/boot
Boot files such as Linux kernel initial RAMdisk
/bin
Program files for normal operations
/sbin
Program files for normal operations not common
/lib
Who is libraries other programs may use
/usr
Hold programs and data used for normal system operation but are non-critical for booting system
/home
Holds users home directories
/root
Root users home directory
/var
Holds variable files such as log files
/tmp
Holes temporary files
/mnt
Mount a point for a removable media
/media
New mount point for removable media
/dev
For devices like USB or mouses
/run
Information about running system
rpm -ql someprogram
Shows were every file in the someprogram package resides on an rpm based system
ls -R
Will show files and subdirectory files
touch -c
Don’t create a new file if one doesn’t exist
used for updating timestamps
Hard link versus soft link
Heartland creates a duplicate under a different name but with the same Inode number
soft link points to original file
Wildcard ? ,* ,[ad], [a-d], [^d]
Matches only 1 char.
* matches any number of characters
ac matches either a or d
a-d matches abcd
^d matches anything but d
$ and ^
^bag matches bagger
$ matches shitbag
grep and commands
-i = ignore case
-r = recursive
-e = egrep or a regular exp
grep examples
grep -r [bd]ash /etc/
grep -E “(games|mail).*nologin” /etc/passwd
find . -name *.txt
Finds all files in current directory that end in .txt
wc -lwc
Counts lines, words and chars
cut d and f flags
cut -f 6 -d “:” /etc/passwd
Selects only field 6, fields are created by the : delimiter
sort
-d is alpha numeric non special char
-n is numerical
Redirection operators
- > > append
- 2> std error, overwrites it
- 2» std error appends
- &> stdout and std error
<> file is used as input and out
$() and backticks
Used to group commands separately
rm $(find ./ -name *~)
Removes all that is found with a tilda at end
tail -n 15 file and head -n 15 file
Last 15 lines or top 15 lines