Bash Commands List Flashcards

All of the bash commands defined in the bash commands list

1
Q

pwd

A

Report the path for the present working directory (cur-
rent directory)

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

cat

A

Read one or more files and write them out one after
another to standard output (often used as a quick way
to look at the contents of a small file). Usage: cat file
or cat file1 file2 file3

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

ls

A

List files in the current direction. Usage: ls or ls path

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

ls -la

A

Long listing including all files

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

ls -R

A

List recursively for all subdirectories

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

who

A

Report who is logged in

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

pinky

A

Give information about a user. Usage pinky -l username

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

date

A

Report the system time

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

cd

A

Change current directory

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

mkdir

A

Make a directory

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

rm

A

Remove files

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

rm -r

A

remove directories

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

rm -i

A

remove interactive mode

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

cp

A

Copy one or more files. Usage: cp old file new file or
cp file1 file2 . . . directory

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

cp -r

A

Copies everything

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

mv

A

Move files to new filenames or new directories. Usage:
mv old name new name or cp file directory

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

mv -i

A

Prompt before overwriting anything

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

more

A

Display the contents of a file to the user one page at a
time. Pressing spacewill let yougo on to the next page.
Usage: more file

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

man

A

Provide online documentation for Unix commands, system calls, configuration files and other features. Usage:
man command name

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

head

A

Print the first ten lines of each file parameter (or from
stdin if no parameter is given). Usage: head file

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

head -n num

A

Print the first num lines of a file
Usage: head -n num filename

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

tail

A

Print the last ten lines of each file parameter (or from
stdin if no parameter is given). Usage: tail file

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

tail -n num

A

Print the last num lines of a file

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

touch

A

Bring the modification time of a file up to the current
time. Also, create an empty file if it doesn’t already
exist. Usage: touch file

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

touch -t

A

Sets modification time for a file to a specific time
Usage: touch -t [YY]YYMMDDHHMM[.ss] oldfile

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

ps

A

Show currently running processes

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

ps -e

A

Report every process

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

ps -l

A

Provide a long listing

29
Q

jobs

A

Show all processes that your shell is keeping up with
along with their job numbers (shell builtin)

30
Q

bg

A

Move a suspended process into the background (shell
builtin). Usage: bg job number

31
Q

fg

A

Move a backgrounded or suspended job to the fore-
ground (shell builtin). Usage: fg job number

32
Q

kill

A

Send a signal to a process asking it to terminate. Usage:
kill process id

33
Q

killall

A

Kill all processes running a given command. Usage:
killall command name

34
Q

echo

A

Just print out its string parameters. Often used with
variable expansion to generate output from a shell
script. Example: echo ”My home is $HOME”

35
Q

echo -n

A

Don’t automatically print a newline at the end
of the output

36
Q

env

A

Report exported environment variables

37
Q

grep

A

Read from files listed on the command line (or stdin)
and report lines that match a given pattern. Usage:
grep pattern file1 file2 . . . Example: grep ”printf”
test.h test.c

38
Q

grep -v

A

Report only lines that don’t match the given
pattern.

39
Q

grep -c

A

Don’t report matching lines, just print the number of lines that match in each input file

40
Q

grep -E

A

Interpret pattern as extended regular expression syntax

41
Q

grep -i

A

Ignore case

42
Q

grep -n

A

Prefix each reported match with the line number

43
Q

grep -q

A

Quiet mode. Don’t print anything. Just use the exit status to report whether or not a match was
found.

44
Q

find path [options]

A

Recursively search directories to find matching files. By default, just print out matching pathnames.
Usage: find path options

45
Q

find path -print

A

Print out each matching path.

46
Q

find path -type f

A

Only report matching files.

47
Q

find path -type d

A

Only report matching directories.

48
Q

find path –mmin -n

A

Report files modified less than n minutes ago

49
Q

find path –mmin +n

A

Report files modified more than n minutes ago.

50
Q

find path –mtime [+-]n

A

Report files modified more/less than n days ago

51
Q

find path -exec command

A

Execute command for each
matching file

52
Q

stat

A

Display information about files. Usage: stat options file

53
Q

stat -c ‘%s’

A

Report size in bytes

54
Q

stat -c ‘%U’

A

Report name of the owner

55
Q

stat -c ‘%G’

A

Report group ownership of the file.

56
Q

sort [options] file

A

Sort lines of given file (or stdin) and output them in sorted order. Usage: sort file or sort

57
Q

sort -n file

A

Interpret each line as a number and sort by magnitude.

58
Q

sort -r file

A

Sort in reverse order.

59
Q

wc file

A

Report the number of bytes, words and lines in a file

60
Q

wc -c file

A

Just report number of bytes

61
Q

wc -w file

A

Just report the number of words

62
Q

wc -l file

A

Just report the number of lines

63
Q

chmod

A

Change the permissions on a file or directory. Usage: chmod options file

64
Q

chmod +x

A

Add execute permissions

65
Q

chmod -w

A

Remove write permissions

66
Q

chmod u+w

A

Add write permissions for the user that owns the file

67
Q

chmod g+r

A

Add read permissions for the group that owns the file

68
Q

chmod o-x

A

Remove execute permissions for others (other than the file’s owner or group)

69
Q

chmod a+r

A

Add read permissions for everyone