COP 4342 Unix Tools
command substitution
$( )
echo '$PATH'
$PATH
ls 2 >/tmp/outfile
2 is fd number, so stderr
date --iso-8601
2020-02-12
magic numbers
2321
process substitution
<( )
egrep
A variant of the grep command, used to search files for patterns using extended regular expressions. special characters like +, ?, !, &
ls -i
Display inode number
most popular Linux desktop distribution
Linux mint (argue Ubuntu)
Author
Mark Sobell
lpr
Print files -P PRINTER -# COUNT
rm -r
Recursively remove files and directories.
less commands
SPACE forward a page b back a page d forward 1/2 u back 1/2
inode
Short for "information node". In UNIX/Linux, a system for storing key information about files.
date '+%A'
Wednesday
variable
a way to reference state in a shell
user shell
accepts keyboard input
process
activation of a program create new entry in process table
system calls
allow us to access and modify resources load arguments into registers
>>
append to file
fg
brings jobs to foreground
date
can also change system date
cp -a DIR1 DIR2
copy preserves ownership, permissions, soft links
grep -c
count matching lines
subshell
created with ( )
ln test.c test1.c
creates a hard link, changes link count on both files to 2
ln -s test.c test2.c
creates a soft link, DOES NOT change link count lrwxrwxrwx 1 flynn 6 Feb 12 11:54 test2.c -> test.c -rw------- 2 flynn 0 Feb 12 11:52 test.c
static executable
does not need any runtime support
UID
each file has this identifying the owner of a file
\
escapes special chars
process interaction
fork
ls -h
human readable
processes
i.e. a shell fork
||
if 1st command succeeds, 2nd is not executed
ls -b
if filename contains a \n, regularly will print as a "?" instead prints as \n
grep -i
ignore case
sort -b
ignore leading blank lines
fgrep
interprets the documents as a list of fixed strings
grep -v
invert match
Linux environment
libraries layered over system calls
hostname
linprog7.cs.fsu.edu after the @
jobs
list all jobs associated with a shell
pstree
list the processes running on a Linux system in a tree like format
grep -l
lists files with matching lines
ls -d
lists name of directory
filesystem interaction
mount
sort -n
numeric sort
initial process tree point
on arch its systemd
I/O interaction
open
sort -u
print unique lines
virtual resources example
process table
daemon
process that provides a service: syslogd
libraries
provide more digestible access to system calls
kernel
provides access to virtual and physical resources
rm -i
queries the user whether or not to remove a link
filter
reads from stdin (fd 0) and writes to stout (fd 1) stderr (fd 2)
script
record session of commands
diff -r
recursive
rm -f
remove without complaining about non-existent items "force"
script executable
requires a separate interpreter (Perl, Python)
dynamically linked executable
requires the services of a runtime linker (/lib64/...)
ls -r
reverse order
sort -r
reverse sort
man -k KEYWORD
search for a keyword in the man pages
bg
sends jobs to background
ls -t
sort by most recently modified
flag
specifies options (- or --)
environmental variable
specifies state for a process
paths starting with /
start at root
built in command
used to change state of the shell itself exit, jobs
who
who else is using a system
last
who used system last
globbing
wildcard system for matching path names *, ?, [ ]