Advanced UNIX Commands Flashcards
Day 5 Advanced UNIX shell Commands
FILE AND DIRECTORY COMMAND
touch
touch -t
touch: Creates an empty file and is also used to modify a files timestamp
touch -t: Manipulates the file’s access date/time stamp
page 81
FILE AND DIRECTORY COMMAND
mkdir
mkdir -p
Creates one or more directories
Creates a directory where no parent exists (nested)
page 81
FILE AND DIRECTORY COMMAND
cp
cp -r
Copies files and directories
Recursively copy directories.
page 81
FILE AND DIRECTORY COMMAND
mv
Moves or renames files and directories
page 81
FILE AND DIRECTORY COMMAND
ln
ln -s
Creates a link between files or directories
Creates a symbolic link to another file.
page 82
FILE AND DIRECTORY COMMAND
rm
rm -r
rm -f
Removes a file or a directory with contents if using the -r option
rm -f : Ignore nonexistent files, never prompt (force).
page 82
FILE AND DIRECTORY COMMAND
grep
Searches a file or files for lines that contain strings of a certain pattern.
page 82
FILE AND DIRECTORY COMMAND
find
Locates files having certain specified characteristics
page 82
FILE AND DIRECTORY COMMAND
which
Displays full path (location) of most (shell) commands
page 82
FILE AND DIRECTORY COMMAND
file
Determines file type.
page 82
FILE AND DIRECTORY COMMAND
ps
ps -e
ps -l
ps -f
Displays a snapshot status of active processes. (A process running in the background is called a daemon )
ps -e: Lists information about every process running
ps -l: Displays in a long format
ps -f: Generates a list in full mode format
Page 83
FILE AND DIRECTORY COMMAND
kill
kill -9
Stops a process from running using its PID
Used to kill a stubborn process that won’t die
page 83
FILE AND DIRECTORY COMMAND
pkill
pkill -9
pkill -HUP
Stops a process from running using its process name
Used to kill a stubborn process that won’t die.
-HUP: Used to immediately re-spawn a process to effect configuration changes. After modifying a daemon’s configuration file, use pkill -HUP to hang up and restart the daemon with the new configuration
page 83
FORENSICS COMMANDS
history
Maintains a history file of all commands run by a particular user in that shell.
page 84
FORENSICS COMMANDS
strings
Prints the strings of printable characters in a file (not ASCII characters). Useful in
determining content of non-text files (executables)
page 84
FORENSICS COMMANDS
script
Creates a typescript of the terminal session (everything printed on the terminal). CTRL+d ends the script session. View results using less.
page 84