Back to AI Flashcard MakerInformation Technology /JCAC Mod 5 Advanced UNIX Commands

JCAC Mod 5 Advanced UNIX Commands

Information Technology42 CardsCreated 4 months ago

This flashcard set explains the touch command in UNIX, used to create empty files or update file timestamps. The touch -t option specifically allows manual modification of a file’s access and modification date/time.

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

Tap or swipe ↕ to flip
Swipe ←→Navigate
1/42

Key Terms

Term
Definition

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

FILE AND DIRECTORY COMMAND
mkdir
mkdir -p

Creates one or more directories
Creates a directory where no parent exists (nested)

FILE AND DIRECTORY COMMAND
cp
cp -r

Copies files and directories
Recursively copy directories.

FILE AND DIRECTORY COMMAND

mv

Moves or renames files and directories

FILE AND DIRECTORY COMMAND
ln
ln -s

Creates a link between files or directories
Creates a symbolic link to another file.

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 (fo...

Related Flashcard Decks

Study Tips

  • Press F to enter focus mode for distraction-free studying
  • Review cards regularly to improve retention
  • Try to recall the answer before flipping the card
  • Share this deck with friends to study together
TermDefinition

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

FILE AND DIRECTORY COMMAND
mkdir
mkdir -p

Creates one or more directories
Creates a directory where no parent exists (nested)

FILE AND DIRECTORY COMMAND
cp
cp -r

Copies files and directories
Recursively copy directories.

FILE AND DIRECTORY COMMAND

mv

Moves or renames files and directories

FILE AND DIRECTORY COMMAND
ln
ln -s

Creates a link between files or directories
Creates a symbolic link to another file.

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).

FILE AND DIRECTORY COMMAND

grep

Searches a file or files for lines that contain strings of a certain pattern.

FILE AND DIRECTORY COMMAND

find

Locates files having certain specified characteristics

FILE AND DIRECTORY COMMAND

which

Displays full path (location) of most (shell) commands

FILE AND DIRECTORY COMMAND

file

Determines file type.

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

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

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

FORENSICS COMMANDS

history

Maintains a history file of all commands run by a particular user in that shell.

FORENSICS COMMANDS

strings

Prints the strings of printable characters in a file (not ASCII characters). Useful in determining content of non-text files (executables)

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.

FORENSICS COMMANDS

su

Used to switch from the current user account to another. It is often used to switch to root user to perform tasks requiring elevated privileges.

FORENSICS COMMANDS

whoami

Displays who the user is logged in as at this moment (after switching user).

FORENSICS COMMANDS

who

Displays user login information including login name, time, terminal, and more

FORENSICS COMMANDS

w

Displays information about the user(s) logged in and what they are doing.

FILE COMPRESSION COMMANDS (only 2)

gzip

Compresses a files and appends a .gz file extension. The original file is replaced

FILE COMPRESSION COMMANDS (only 2)

gunzip

Decompresses a file that was compressed with gzip

ARCHIVING COMMANDS (1 command, 7 options)

tar

Tape archive utility used to archive files to tape or disk

ARCHIVING COMMANDS (1 command, 7 options)

tar -c (lowercase c)

Create an archive

ARCHIVING COMMANDS (1 command, 7 options)

tar -t

List table of contents of tar file

ARCHIVING COMMANDS (1 command, 7 options)

tar -x

Extract, must be in target directory to extract

ARCHIVING COMMANDS (1 command, 7 options)

tar -z

Compress the archived file using gzip (tarball)

ARCHIVING COMMANDS (1 command, 7 options)

tar -v

Verbose, list each file as tar reads/writes

ARCHIVING COMMANDS (1 command, 7 options)

tar -f

Read/write to or from a file

ARCHIVING COMMANDS (1 command, 7 options)

tar -C (capital c)

Change to directory

SCHEDULING JOBS COMMANDS

| at

Schedules a job/process for a one-time execution

SCHEDULING JOBS COMMANDS

| atq

Lists user’s pending jobs.

SCHEDULING JOBS COMMANDS

| atrm

Deletes user’s jobs identified by job number

SCHEDULING JOBS COMMANDS

| crontab

Schedules periodic jobs. The cron daemon (crond) checks the /etc/crontab every minute for any jobs that need to run. To create a cron job, the cron table (crontab) is created or modified.

SCHEDULING JOBS COMMANDS (crontab option)

| crontab -e

Edit the crontab

SCHEDULING JOBS COMMANDS (crontab option)

| crontab -l

List crontab entries

USER ACCOUNT RELATED COMMANDS

| useradd

Creates a new user or updates default new user information

USER ACCOUNT RELATED COMMANDS (useradd opt)

| useradd -d

Specifies the path of the user’s home directory;
Linux - users’ home directories are in /home

USER ACCOUNT RELATED COMMANDS (userad opt)

| useradd -m

Makes a home directory if it doesn’t already exist

Makes a home directory if it doesn’t already exist

Assigns whatever group is in default

USER ACCOUNT RELATED COMMANDS
userdel
userdel -r

Deletes a user account
Removes the home directory for specified user

USER ACCOUNT RELATED COMMANDS

| passwd

Enables a user to change their password (no user name) or for root to set and modify password settings.