commands and switches Flashcards
(75 cards)
find [path] -name “[name]”
find files and subdirs
find [path] -type d -name “[dir]”
find subdirs
ldconfig –print-cache
Print the lists of directories and candidate libraries stored in the current cache. Pipe into grep to find if a particular library is installed and accessible.
type [cmd]
Find whether the given command is an alias, shell built-in, file, function, or keyword. Also displays path
type -t [cmd]
Show just type
type -p [cmd]
Show just path
type -a [cmd]
Show all info
du [paths]
Disk usage
du -h [path]
Disk usage in human readable form
strace -f [program]
Trace child processes
strace -o “filename”
Output to log
strace -p PID
Attach
strace trace=open
Show opened files
rename ‘s/[old regex]/[new regex]/’
Batch rename
rename ‘s/-//’ ./*
remove dashes in all names in current folder: (1st dash)
grep [path] -e [pattern]
Search for pattern in path
grep -r
recursive
grep -n
display line number
grep -w
search for whole word
grep -l
show just file names
[[ -a file ]]
Test if file/dir exists. Identical to -e
[[ -d file ]]
Test if directory exists
[[ -f file ]]
True if file exists and is a regular file.
[[ -e file ]]
Test if file/dir exists. Identical to -a