Linux Command syntax

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/50

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

51 Terms

1
New cards

What are options used for?

used to modify the core behavior of a command

2
New cards

What are arguments used for?

used to provide additional information (such as a filename or a username)

3
New cards

What does the -l option of the ls command do?

results in a long listing, providing additional info about files that are listed

4
New cards

What does -r do?

prints results in reverse aphabetical order

5
New cards

what does -h do

puts file sizes into human-readable format. This option must be used with the -l option.

6
New cards

in context of the history command, what does the ! character do?

executes the number of the command to execute it. for instance, if the third command listed by the history command was the date command, !3 would execute the date command again

7
New cards

what does the !-n command do?

executes the nth command from the bottom of the history list

8
New cards

what does !! do?

executes the most recent command

9
New cards

what executes the most recent iteration of a specific command?

! plus the name of the command

10
New cards

What does the export command do?

turns a local variable into an environment variable, and can also be used to make a variable an environment variable upon its creation by using the assignment expression as the argument

11
New cards

what do you use to change the value of an environment variable

use the assignment expression

12
New cards

what does the unset command do?

removes exported variables

13
New cards

What does the type command do?

determines info about the command type of the command that is attached to it in the command

14
New cards

what does the which command do?

displays the full path to the command in question by searching the path variable

15
New cards

what does the -a option of the type command do?

displays all locations that contain the command named

16
New cards

what do double quotes still allow for?

command substitution, variable substitution, and other metacharacters

17
New cards

what are backquotes used for?

used to specify a command within a command

18
New cards

what does the -f option of the man page command do?

searches for man pages by name

On most Linux distributions, the whatis command does the same thing as man -f. On those distributions, both will produce the same output.

19
New cards

what does the -k option of the man page command do?

searches both names and descriptions of the man pages for a keyword

On most Linux distributions, the apropos command does the same thing as man -k. On those distributions, both produce the same output.

20
New cards

why are man pages easily distinguished from commands?

they are typically compressed with a gzip, therefore they end in .gz

21
New cards

What does the locate command do?

searches a database of all files and directories that were on the system when the database was created, Any files created today will not be searchable with this command

22
New cards

what does updatebd do?

updates the locate database manually, if root is available

23
New cards

what does the -c option of the locate command do?

what does the -b option do?

finds out how many files match

this option only includes listings that have the search item in the basename of the filename

24
New cards

while in man pages and info documents, what does Shift+H, L, and Q do?

lists movement commands,

closes the help screen

quits the info or man page

25
New cards

what does the pwd command do?

prints the working directory

26
New cards

what does .. always represent?

represents one directory higher than the current directory/the parent directory

27
New cards

what does . always represent

always represents the current directory

28
New cards

what does the -a option to the ls command do?

lists hidden files

29
New cards

What are the 7 different file types?

d

directory

A file used to store other files.

-

regular file

Includes readable files, images files, binary files, and compressed files.

l

symbolic link

Points to another file.

s

socket

Allows for communication between processes.

p

pipe

Allows for communication between processes.

b

block file

Used to communicate with hardware.

c

character file

30
New cards

what does the -d option of the ls command do?

refers to the current directory, and not the contents within it. To use this option in a meaningful way requires the addition of the -l option

31
New cards

What does the -R option of the ls command do?

performs a recursive listing

32
New cards

What does the -s option of the ls command do?

sorts files by size. it is most useful when used with -l option so the file sizes are visible

For more detailed modification time information you can use the --full-time option to display the complete timestamp (including hours, minutes, seconds). It will assume the -l option automatically:

33
New cards

What does the -t option of the ls command do?

sorts files based on the time they were modified

34
New cards

what does these commands do:

/etc/[gu]*

/etc/[a-d]*

/etc/*[0-9]*

matches any file that begins with either a g or u character and contains zero or more additional characters

matches all files that begin with any letter between and including a and d:

displays any file that contains at least one number:

35
New cards

The exclamation point ! character used in conjunction with the square brackets is used to do what?

negate a range

36
New cards

When listing with globs, what does the -d option of the ls command do?

tells the ls command to display the name of directories, instead of contents

37
New cards

what are the different options for the cp command and what do they do?

cat - view the contents of the file

-i - makes the command prompt the user before overwriting a file

-n - answers no to each interactive promt automatically. stands for no clobber/no overwrite

38
New cards

what does the -r option of the cp command do?

allows the command to copy both files and directories

39
New cards

why is there no -r option in the mv command?

the command moves directories by default

40
New cards

how can you delete a directory with the rm command?

use either -r or rmdir. rmdir can only be used if the directory’s empty

41
New cards

what gzip commands decompress a file?

gunzip and gzip -d

42
New cards

What does the tar command do?

takes in several files and creates a single output file that can be split up again into the original files on the other end of the transmission.

43
New cards

What does the -c option in the tar command do?

what does this command do: tar -cf alpha_files.tar alpha*

creates an archive

a tar file, also called a tarball, being created from multiple files. The first argument creates an archive called alpha_files.tar. The wildcard option * is used to include all files that begin with alpha in the archive:

44
New cards

what does the -z option of the tar command do?

compresses/decompresses an archive using the gzip command and using .tar.gz or .tgz for compressed tarballs.

45
New cards

what does the -j option of the tar command do?

tells tar to use bzip2 compression instead of gzip compression and using .tar.bz2, .tbz, or .tbz2 as the file extension.

46
New cards

what does the -t option of the tar command do?

lists files in an archive

47
New cards

what does the -x option of the tar command do?

extracts files from an archive

48
New cards

What does the attribution (BY) condition mean?

All CC licenses require that the creator must be given credit, without implying that the creator endorses the use.

49
New cards

What does the sharealike (SA) condition mean?

This allows others to copy, distribute, perform, and modify the work, provided they do so under the same terms.

50
New cards

What does the non-commercial (NC) condition mean?

This allows others to distribute, display, perform, and modify the work for any purpose other than commercially.

51
New cards

What does the NoDerivatives (ND) condition mean?

This allows others to distribute, display, and perform only original copies of the work. They must obtain the creator’s permission to modify it.