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
touch -t
Sets modification time for a file to a specific time Usage: touch -t [YY]YYMMDDHHMM[.ss] oldfile
26
ps
Show currently running processes
27
ps -e
Report every process
28
ps -l
Provide a long listing
29
jobs
Show all processes that your shell is keeping up with along with their job numbers (shell builtin)
30
bg
Move a suspended process into the background (shell builtin). Usage: bg job number
31
fg
Move a backgrounded or suspended job to the fore- ground (shell builtin). Usage: fg job number
32
kill
Send a signal to a process asking it to terminate. Usage: kill process id
33
killall
Kill all processes running a given command. Usage: killall command name
34
echo
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
echo -n
Don’t automatically print a newline at the end of the output
36
env
Report exported environment variables
37
grep
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
grep -v
Report only lines that don’t match the given pattern.
39
grep -c
Don’t report matching lines, just print the number of lines that match in each input file
40
grep -E
Interpret pattern as extended regular expression syntax
41
grep -i
Ignore case
42
grep -n
Prefix each reported match with the line number
43
grep -q
Quiet mode. Don’t print anything. Just use the exit status to report whether or not a match was found.
44
find path [options]
Recursively search directories to find matching files. By default, just print out matching pathnames. Usage: find path options
45
find path -print
Print out each matching path.
46
find path -type f
Only report matching files.
47
find path -type d
Only report matching directories.
48
find path --mmin -n
Report files modified less than n minutes ago
49
find path --mmin +n
Report files modified more than n minutes ago.
50
find path --mtime [+-]n
Report files modified more/less than n days ago
51
find path -exec command
Execute command for each matching file
52
stat
Display information about files. Usage: stat options file
53
stat -c '%s'
Report size in bytes
54
stat -c '%U'
Report name of the owner
55
stat -c '%G'
Report group ownership of the file.
56
sort [options] file
Sort lines of given file (or stdin) and output them in sorted order. Usage: sort file or sort
57
sort -n file
Interpret each line as a number and sort by magnitude.
58
sort -r file
Sort in reverse order.
59
wc file
Report the number of bytes, words and lines in a file
60
wc -c file
Just report number of bytes
61
wc -w file
Just report the number of words
62
wc -l file
Just report the number of lines
63
chmod
Change the permissions on a file or directory. Usage: chmod options file
64
chmod +x
Add execute permissions
65
chmod -w
Remove write permissions
66
chmod u+w
Add write permissions for the user that owns the file
67
chmod g+r
Add read permissions for the group that owns the file
68
chmod o-x
Remove execute permissions for others (other than the file’s owner or group)
69
chmod a+r
Add read permissions for everyone