Linux commands/knowledge Flashcards

1
Q

pwd (command)

A

Print working directory (directory you’re currently in)

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

reboot (command)

A

Shut down and restart the system

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

find (command)

A

Locate a file in the current directory.

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

What port is used to SSH into a server?

A

Port 22

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

which (command)

A

Gives location of an application.

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

Describe a distribution

A

An OS that uses the Linux kernel, but has its own utilities, configs, and widgets.

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

Linux distribution must have _____.

A

The Linux kernel.

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

sudo (command)

A

Run previous command as root user.

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

ls-a (command)

A

Will list all files including hidden.

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

ls-R (command)

A

Runs ls command with recursion.

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

clear (command)

A

Clears screen

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

whoami (command)

A

shows username for current user

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

ls -l (command)

A

Long listing, gives additional information such as: file/directory ownership, permissions, and size.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  1. ls -S (command)

2. ls -rS (command)

A
  1. Sort by size with largest files listed first.

2. Sort by size with smallest files listed first.

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

ls -t (command)

A

Sorts file in directory by last time modified.

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

mkdir (command)

A

Make directory

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

mv

A

Move

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

env (command)

A

List variables for the current shell environment.

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

exit (command)

A

Leave shell environment you’re logged in to.

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

halt (command)

A

Shuts down a system.

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

shutdown (command)

A

Can be used to reboot, power off, or cancel shutdown. Will be followed by another switch (-H, -P, -r, -c).

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

top (command)

A

Displays top running processes on the system. Pressing H key will give you options to run out of top.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
  1. uname (command)
  2. uname -r
  3. uname -v
  4. uname -m
  5. uname -o
  6. uname -a
A
  1. Displays name of system kernel. (Linux)
  2. Displays kernel release #.
  3. Displays kernel build version
  4. Displays machine type. (32 or 64 bit)
  5. Displays name of OS.
  6. Displays all uname information.
24
Q

cd (command)

A

Change directory. i.e cd/path or cd/folder, cd by itself will return you to home directory.

25
Q

cd- (command)

A

Returns you to last/previous directory.

26
Q

cd~ (command)

A

Returns user to home directory.

27
Q

bash_history

A

A hidden file within your home directory that contains a log of commands entered. Ex., (cat .bash_history)

28
Q

echo $HISTFILESIZE

A

Variable for how many lines of history to keep.

29
Q

echo $HISTCONTROL

A

Variable that can adjust history behavior.

30
Q

history (command)

A

Prints out commands saved in .bash_history with commands numbered. You can type !numbered command, example !38 to run that command.

31
Q

TAB key

A

Autocompletes file and directory names.

32
Q

variable

A

Placeholder for a value. Think of a cup that contains (value). Variable is the cup. To act on a variable use $ (i.e. $PWD)

33
Q

echo $VARIABLE

A

prints the value of the variable

34
Q

Format for declaring new variables in bash

A

VARIABLENAME=value

35
Q

set (command)

A

Lists out environment variables in alphabetical order

36
Q

export VARIABLE

A

Exports variable and its value to other shells.

37
Q

*

A

Globbing character

Stands in for any characters, i.e. *.txt to show all .txt files

38
Q

?

A

Globbing character

Stands in for single character, i.e. ????.txt will show any four letter.txt file (junk.txt)

39
Q

[AaBbCc]

A

Globbing character

Matches the listed characters, case sensitive.
I.e. [Pp]*.csv will show any .csv file that begins with an upper or lower case P.

40
Q

[^Aa]

A

Globbing character

Will exclude the listed character

I.e. ls [^W] will exclude all files starting with upper case W.

41
Q

[0-9]

A

Globbing character

Matches that range of numbers

ls report199[0-9]-2017.txt

42
Q

“”

A

Double quotes

Stings, variables, and commands in these will get acted on.

43
Q

‘’

A

Single quotes

Anything within these are treated literally. Disables special character functions like the $.

44
Q

\

A

Backslash

Disables any special character functions that immediately follows it.

Example
echo “Hey can I borrow $3.50”

This will disable the dollar sign

45
Q

locate (command)

A

Searches files/folders for items that match criteria

locate cd

46
Q

find (command)

A

Searches the file system for files that match search criteria

find /home/user/.config -name ‘*.xml’

47
Q

man (command)

A

Reference for commands, like a dictionary.

Sections 1-9

man ls

48
Q

whatis (command)

A

Lists summary and related man pages for search term.

whatis ls

49
Q

apropos (command)

A

Searches man pages for keyword provided.

apropos passwd

50
Q

info (command)

A

Similar to man pages but has the ability to hyperlink to other pages.

51
Q
  1. tar
  2. tar -c
  3. tar -z
  4. tar -j
  5. tar -f
  6. tar -x
  7. tar -v
A
  1. tar Archive a bundle of files together
  2. -c Used to create new archive
  3. -z Pass archive thru gzip compression
  4. -j Pass archive thru bzip2 compression
  5. -f Create archive file name
  6. -x Extract an archive
  7. -v Verbose output
52
Q

head (command)

head -n

A

Views first 10 lines in a file

  • n allows you to specify different number of lines
  • n 20 filename.txt will show first 20 lines in a file
53
Q

tail (command)
tail -n
tail -f

A

Views last 10 lines in a file

-n allows you to change number of lines specified

tail -n 30 will show last 30 lines in a file

tail -f follows data to file in real time

54
Q

Ctrl + C

A

Stops a command that is currently running

55
Q

cut (command)
cut -d
cut -f

A

Removes text from file

cut -d specific delimiter to use

cut -f specifies what field to print

56
Q

sort (command)

sort -n

A

Sorts content alphabetically

-n sorts content numerically

57
Q

> (command)

|&raquo_space; (command)

A

> redirects standard output (what you see with cat) to new location, if sent to a file it will replace content from that file.

> > redirects standard output to new location, appends content to file rather than replacing it.