Unix Commands Flashcards

To familiarize those with some basic Unix shell commands. Credit goes to http://freeengineer.org/learnUNIXin10minutes.html for the list of Unix command I made the flash cards from.

1
Q

ls

A

list directory contents

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

cd

A

change directory

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

mkdir

A

make directory

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

cp [file1] [file2]

A

copys a file

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

mv [file1] [file2]

A

move or rename a file

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

/

A

root directory

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

/usr

A

usr directory

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

chmod 755 file

A

Changes the permissions of file to be rwx for the owner, and rx for the group and the world. (7 = rwx = 111 binary. 5 = r-x = 101 binary)

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

ls -a

A

List all files in current directory including hidden files

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

ls -l

A

list a directory in long ( detailed ) format

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

cat filename

A

Dump a file to the screen in ascii.

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

echo $SHELL

A

Denotes what shell you are using.

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

export PROJECTS=/usr/local/projects

A

Defines the environment variable PROJECTS with the value /usr/local/projects.

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

cd $PROJECTS

A

Changes your present working directory to the value of the environment variable PROJECTS

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

echo $PROJECTS

A

Prints out the value of PROJECTS, or /usr/local/projects

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

find . -name aaa.txt

A

Finds all the files named aaa.txt in the Current directory or any subdirectory tree.

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

find / -name vimrc

A

Find all the files named ‘vimrc’ anywhere on the system.

18
Q

find search_path -name filename

A

Find command

19
Q

chown bruce file

A

Makes user bruce owner of file

20
Q

chown -R bruce dir

A

Makes user bruce owner of directory and everything in its directory tree.

21
Q

chgrp user file

A

Makes file belong to the group user.

22
Q

~

A

Home directory

23
Q

rm file1 [file2 …]

A

Remove or delete a file

24
Q

rm -r dir1 [dir2…]

A

recursivly remove a directory and its contents

25
Q

rmdir dir1 [dir2…]

A

remove an empty directory

26
Q

more filename

A

Progressively dump a file to the screen: ENTER = one line down, SPACEBAR = page down, q=quit

27
Q

head filename

A

Show the first few lines of a file.

28
Q

head -n filename

A

Show the first n lines of a file

29
Q

tail filename

A

Show the last few lines of a file.

30
Q

tail -n filename

A

Show the last n lines of a file.
Show the last n lines of a file.
Show the last n lines of a file.

31
Q

ls -ld *

A

List all the file and directory names in the current directory using long format. Without the “d” option, ls would list the contents of any sub-directory of the current. With the “d” option, ls just lists them like regular files.

32
Q

touch

A

Changes the date/time stamp of the file filename to the current time. Creates an empty file if the file does not exist. You can change the stamp to any date using

33
Q

users

A

List users currently logged in

34
Q

killall

A

Kill processes by name

35
Q

ps

A

process status

36
Q

tar

A

tape archive

37
Q

tar xv

A

Extracts (x) files from the default tape drive while listing (v = verbose) the file names to the screen.

38
Q

ping

A

Test a network connection

39
Q

who

A

Print all usernames currently logged in

40
Q

whoami

A

Print the current user id and name (`id -un’)

41
Q

wget

A

Retrieve web pages or files via HTTP, HTTPS or FTP