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
shutdown
Powers off your machine in one minute but you can change the time to shutdown now Or shutdown 20:40
26
shutdown -c
Cancels shutdown
27
htop
Interactive process viewer
28
unzip
Extract .zip files
29
apt, yum, pacman
Access package managers (basically software manager) Example installing gimp: sudo apt install gimp sudo yum install gimp sudo pacman -S gimp
30
echo
Displays defined text echo “cool message”
31
cat
Concatenate, lets you create, view, and concatenate files Mainly used to preview a file without opening a text editor
32
ps
Look at the processes your current shell is running Tells you process ID (PID), TellTYpewriter (TTY), time, and command name
33
htop
More interactive ps
34
kill
Stop a process. Use process ID or the programs binary name
35
ping
Test network connectivity ping google.com ping 8.8.8.8
36
vim
Free open source terminal text editor
37
history
Command history
38
passwd
Change the password of user accounts
39
which
Outputs the full path of shell commands Ex: which python Output: # /usr/bin/python
40
shred
Makes a file almost unrecoverable
41
less
Inspect files backward and forward More interactive than cat
42
tail
Prints the contents of a file but only last ten lines
43
tail -n
Lets you change the number of lines Ex: tail -n 4 long.text You’ll only see the last four lines
44
head
Outputs first ten lines of a text file Can use -n with it as well
45
grep
Searches for lines in a text file that match a regular expression and print them Ex: grep “linux”
46
grep -c
Counts the number of times the pattern repeats
47
whoami
Displays username currently in use Can also use echo $USER
48
whatis
Prints a single line description of any other command Ex: whatis python
49
wc
Word count Lines, words, byte-size, name of the file
50
wc -w
Only word count
51
uname -a
Unix name. operative system information.
52
neofetch
Displays system info CLI tool that displays information about your system like kernel version, shell, and hardware
53
find
Searches for files in a directory hierarchy based on regex expression Syntax: find [flags] [path] -name [expression]
54
wget
World Wide Web get. Retrieve content from the internet