Linux Commands Flashcards

1
Q

ls

A

List the contents of the directory you want

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

alias

A

Let’s you define temporary aliases in your shell session

Replace a word with a series of commands

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

unalias

A

Remove alias

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

pwd

A

print working directory

Ex: /home/john/Documents

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

cd

A

Change directory

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

cd ..

A

Move up a level

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

cd -

A

Return to previous directory

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

cp

A

Copy files and folder

Just add source and destination

Ex:
cp file_to_copy.txt new_file.txt

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

rm

A

Remove files and directories

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

cp -r

A

Copy entire directories

In Linux, files end with forward slash

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

rm -r

A

Delete empty dorectory

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

rm -rf

A

Remove directory with content

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

mv

A

Move or rename files and directories

Move:
mv source_file destination_folder/

Rename:
mv old_file_name.txt new_file_name.txt

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

mkdir

A

Create folders

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

mkdir -p

A

Create subdirectories

Ex:
mkdir -p movies/2004/

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

man

A

Displays manual page of any other command

Ex:
man mkdir

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

touch

A

Create new empty file

Ex:
touch new_file_name

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

chmod

A

Change the file permissions or mode

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

chmod +r

A

read

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

chmod +w

A

Write

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

chmod +x

A

Execute

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

./

A

Flag that lets your shell run an executable file

For example you can run a python script.

Ex:
chmod +x script
./script

23
Q

Exit

A

Closes the terminal

24
Q

sudo

A

“Superuser do”
Basically run as admin

Ex:
sudo apt install gimp

25
Q

shutdown

A

Powers off your machine in one minute but you can change the time to

shutdown now

Or

shutdown 20:40

26
Q

shutdown -c

A

Cancels shutdown

27
Q

htop

A

Interactive process viewer

28
Q

unzip

A

Extract .zip files

29
Q

apt, yum, pacman

A

Access package managers (basically software manager)

Example installing gimp:
sudo apt install gimp
sudo yum install gimp
sudo pacman -S gimp

30
Q

echo

A

Displays defined text

echo “cool message”

31
Q

cat

A

Concatenate, lets you create, view, and concatenate files

Mainly used to preview a file without opening a text editor

32
Q

ps

A

Look at the processes your current shell is running

Tells you process ID (PID), TellTYpewriter (TTY), time, and command name

33
Q

htop

A

More interactive ps

34
Q

kill

A

Stop a process. Use process ID or the programs binary name

35
Q

ping

A

Test network connectivity
ping google.com
ping 8.8.8.8

36
Q

vim

A

Free open source terminal text editor

37
Q

history

A

Command history

38
Q

passwd

A

Change the password of user accounts

39
Q

which

A

Outputs the full path of shell commands

Ex:
which python

Output:
# /usr/bin/python

40
Q

shred

A

Makes a file almost unrecoverable

41
Q

less

A

Inspect files backward and forward

More interactive than cat

42
Q

tail

A

Prints the contents of a file but only last ten lines

43
Q

tail -n

A

Lets you change the number of lines

Ex:
tail -n 4 long.text

You’ll only see the last four lines

44
Q

head

A

Outputs first ten lines of a text file

Can use -n with it as well

45
Q

grep

A

Searches for lines in a text file that match a regular expression and print them

Ex:
grep “linux”

46
Q

grep -c

A

Counts the number of times the pattern repeats

47
Q

whoami

A

Displays username currently in use

Can also use echo $USER

48
Q

whatis

A

Prints a single line description of any other command

Ex:
whatis python

49
Q

wc

A

Word count

Lines, words, byte-size, name of the file

50
Q

wc -w

A

Only word count

51
Q

uname -a

A

Unix name.

operative system information.

52
Q

neofetch

A

Displays system info

CLI tool that displays information about your system like kernel version, shell, and hardware

53
Q

find

A

Searches for files in a directory hierarchy based on regex expression

Syntax:
find [flags] [path] -name [expression]

54
Q

wget

A

World Wide Web get.

Retrieve content from the internet