Basic Linux commands for Devs Flashcards

1
Q

man {command}

A

use to get more details about the specified command and arguments that can be used with it

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

pwd

A

“Present working directory”. prints the path to the current directory

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

open {filename/url}

A

used to open the specified file or internet URL

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

ls

A

list all files and folders in the current directory

-a : adds hidden elements
-l : long format (adds more information)
-al : does both

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

mkdir {name}

A

used to create a new folder/directory

can also make multiple at once by adding space separated names ex.
mkdir folder1 folder2 folder3

-p: create nested folders
ex:
mkdir -p foler1/nested

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

touch {name}

A

used to create new files.
ex:
touch file.txt
touch file.txt file2.py

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

rmdir

A

used to remove empty folders
ex:
rmdir folder

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

rm

A

used to remove empty or non-empty folders/directories/files
ex:
rm file.txt
rm -d empty_folder
rm -r non_empty_folder
rm -r * (removes all files/folders in current directory)

note:
files will not be moved to recycle bin, it is a permanent deletion.

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

cp {file} {folder}

A

used to copy files into the target folder
ex:
cp file1.txt folder

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

mv {file} {folder}

A

used to move files into the target folder
ex:
mv file1.txt folder

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

history

A

used to show all commands that have been typed into the Linux shell.

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

diff {file1} {files2}

A

used to show the difference between two files

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

head {filename}

A

used to show the first {10 lines default} of the file
ex:
head -n 15 logfile.txt
{will show the first 15 lines of logfile.txt}

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

tail {filename}

A

used to show the last{10 lines default} of the file
ex:
tail -n 15 logfile.txt
{will show the last 15 lines of logfile.txt}

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

echo {msg/$variable}

A

used to print things to the terminal.
ex:
echo $username
{prints value of username}

echo *.txt
{prints all txt files in the dir to terminal}

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

ping {url / IP address}

A

pings the given address to check connectivity.
will run indefinitely every second until killed with {cntrl + C}