Command Line - Commands + Clarifiers Flashcards

1
Q

Which command is used to change directories?

A

cd
cd /Desktop

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

Which command creates a new file in the command line?

A

touch
touch newfile.txt

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

Which command creates a new directory (folder) in the command line?

A

mkdir
mkdir myFolder

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

Which command displays a list of previously entered commands?

A

history
history

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

Which command opens files in VS Code from the command line?

A

code
code example.js

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

Which command lists the contents of the current directory?

A

ls
ls -l

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

Which command copies files or directories?

A

cp
cp file.txt /newlocation/

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

Which command moves or renames files or directories?

A

mv
mv oldname.txt newname.txt

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

Which command removes files or directories?

A

rm
rm file.txt or rm -r myFolder

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

Which command displays the contents of a file?

A

cat
cat file.txt

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

Which command shows the current working directory?

A

pwd
pwd

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

Which command prints a message or variable value?

A

echo
echo ‘Hello, World!’

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

Which command searches for patterns in files?

A

grep
grep ‘pattern’ file.txt

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

Which command searches for files and directories based on criteria?

A

find
find /path -name ‘file.txt’

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

Which command changes file or directory permissions?

A

chmod
chmod 755 file.txt

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

Which command changes file ownership?

A

chown
chown user:group file.txt

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

Which command creates or extracts an archive file?

A

tar
tar -cvf archive.tar file1 file2

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

Which command compresses files, and which command extracts them?

A

zip / unzip
zip archive.zip file1 file2 / unzip archive.zip

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

Which command allows a user to execute commands with superuser privileges?

A

sudo
sudo apt-get update

20
Q

Which command displays currently running processes?

21
Q

Which command terminates a process?

A

kill
kill 1234

22
Q

Which command shows real-time system processes and resource usage?

23
Q

Which command shows the available and used disk space?

24
Q

Which command shows the disk usage of files and directories?

A

du
du -sh /directory/

25
Which commands are used to edit files in the command line?
nano / vim nano file.txt / vim file.txt
26
Which command downloads files from the web?
wget wget http://example.com/file.zip
27
Which command transfers data to or from a server using protocols like HTTP or FTP?
curl curl http://example.com
28
Which command securely copies files between hosts over a network?
scp scp file.txt user@remote:/path/
29
Which command synchronizes files and directories between two locations?
rsync rsync -avz /source/ /destination/
30
Which command checks the network connection between your machine and a host?
ping ping google.com
31
Which command displays network connections, routing tables, and interface statistics?
netstat netstat -a
32
Which command configures or displays network interface settings?
ifconfig ifconfig eth0
33
Which command queries DNS records for domain names?
nslookup nslookup example.com
34
Which command shows the route packets take to reach a network host?
traceroute traceroute google.com
35
Which command shows how long the system has been running since the last reboot?
uptime uptime
36
Which command displays the current logged-in user name?
whoami whoami
37
Which command creates a shortcut for a longer command or set of commands?
alias alias ll='ls -la'
38
Which command removes an existing alias?
unalias unalias ll
39
Which command displays the manual or documentation for a specific command?
man man ls
40
Which command displays the first few lines of a file?
head head -n 10 file.txt
41
Which command displays the last few lines of a file?
tail tail -n 10 file.txt
42
Which command compares the contents of two files and shows the differences between them?
diff diff file1.txt file2.txt
43
Which command sorts the lines of a file or input in alphabetical or numerical order?
sort sort file.txt
44
Which command removes duplicate lines from a file?
uniq uniq file.txt
45
Which command counts the number of lines, words, and characters in a file?
wc wc file.txt
46
Which command reads input and writes the output both to a file and the terminal?
tee echo 'text' | tee file.txt
47
Which command constructs and executes commands using input from standard input?
xargs echo 'file1 file2' | xargs rm