Advanced UNIX Commands Flashcards

Day 5 Advanced UNIX shell Commands

1
Q

FILE AND DIRECTORY COMMAND
touch
touch -t

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

FILE AND DIRECTORY COMMAND
mkdir
mkdir -p

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

FILE AND DIRECTORY COMMAND
cp
cp -r

A

Copies files and directories
Recursively copy directories.
page 81

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

FILE AND DIRECTORY COMMAND

mv

A

Moves or renames files and directories

page 81

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

FILE AND DIRECTORY COMMAND
ln
ln -s

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

FILE AND DIRECTORY COMMAND
rm
rm -r
rm -f

A

Removes a file or a directory with contents if using the -r option
rm -f : Ignore nonexistent files, never prompt (force).
page 82

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

FILE AND DIRECTORY COMMAND

grep

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

FILE AND DIRECTORY COMMAND

find

A

Locates files having certain specified characteristics

page 82

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

FILE AND DIRECTORY COMMAND

which

A

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

page 82

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

FILE AND DIRECTORY COMMAND

file

A

Determines file type.

page 82

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

FILE AND DIRECTORY COMMAND
ps

ps -e
ps -l
ps -f

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

FILE AND DIRECTORY COMMAND
kill
kill -9

A

Stops a process from running using its PID
Used to kill a stubborn process that won’t die
page 83

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

FILE AND DIRECTORY COMMAND
pkill
pkill -9
pkill -HUP

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

FORENSICS COMMANDS

history

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

FORENSICS COMMANDS

strings

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

FORENSICS COMMANDS

script

A

Creates a typescript of the terminal session (everything printed on the terminal). CTRL+d ends the script session. View results using less.
page 84

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

FORENSICS COMMANDS

su

A

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.
page 85

18
Q

FORENSICS COMMANDS

whoami

A

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

19
Q

FORENSICS COMMANDS

who

A

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

20
Q

FORENSICS COMMANDS

w

A

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

21
Q

FILE COMPRESSION COMMANDS (only 2)

gzip

A

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

22
Q

FILE COMPRESSION COMMANDS (only 2)

gunzip

A

Decompresses a file that was compressed with gzip

page 86

23
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar
A

Tape archive utility used to archive files to tape or disk

page 87

24
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -c  (lowercase c)
A

Create an archive

page 87

25
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -t
A

List table of contents of tar file

page 87

26
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -x
A

Extract, must be in target directory to extract

page 87

27
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -z
A

Compress the archived file using gzip (tarball

page 87

28
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -v
A

Verbose, list each file as tar reads/writes

page 87

29
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -f
A

Read/write to or from a file

page 87

30
Q
ARCHIVING COMMANDS (1 command, 7 options)
tar -C  (capital c)
A

Change to directory

page 87

31
Q

SCHEDULING JOBS COMMANDS

at

A

Schedules a job/process for a one-time execution

page 88

32
Q

SCHEDULING JOBS COMMANDS

atq

A

Lists user’s pending jobs.

page 88

33
Q

SCHEDULING JOBS COMMANDS

atrm

A

Deletes user’s jobs identified by job number

page 88

34
Q

SCHEDULING JOBS COMMANDS

crontab

A

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.
page 88

35
Q

SCHEDULING JOBS COMMANDS (crontab option)

crontab -e

A

Edit the crontab

page 88

36
Q

SCHEDULING JOBS COMMANDS (crontab option)

crontab -l

A

List crontab entries

page 88

37
Q

USER ACCOUNT RELATED COMMANDS

useradd

A

Creates a new user or updates default new user information

page 89

38
Q

USER ACCOUNT RELATED COMMANDS (useradd opt)

useradd -d

A

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

39
Q

USER ACCOUNT RELATED COMMANDS (userad opt)

useradd -m

A

Makes a home directory if it doesn’t already exist

page 89

40
Q

USER ACCOUNT RELATED COMMANDS (useradd opt)

useradd -n

A

Assigns whatever group is in default

page 89

41
Q

USER ACCOUNT RELATED COMMANDS
userdel
userdel -r

A

Deletes a user account
Removes the home directory for specified user
page 89

42
Q

USER ACCOUNT RELATED COMMANDS

passwd

A

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