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?

A

ps
ps aux

21
Q

Which command terminates a process?

A

kill
kill 1234

22
Q

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

A

top
top

23
Q

Which command shows the available and used disk space?

A

df
df -h

24
Q

Which command shows the disk usage of files and directories?

A

du
du -sh /directory/

25
Q

Which commands are used to edit files in the command line?

A

nano / vim
nano file.txt / vim file.txt

26
Q

Which command downloads files from the web?

A

wget
wget http://example.com/file.zip

27
Q

Which command transfers data to or from a server using protocols like HTTP or FTP?

A

curl
curl http://example.com

28
Q

Which command securely copies files between hosts over a network?

A

scp
scp file.txt user@remote:/path/

29
Q

Which command synchronizes files and directories between two locations?

A

rsync
rsync -avz /source/ /destination/

30
Q

Which command checks the network connection between your machine and a host?

A

ping
ping google.com

31
Q

Which command displays network connections, routing tables, and interface statistics?

A

netstat
netstat -a

32
Q

Which command configures or displays network interface settings?

A

ifconfig
ifconfig eth0

33
Q

Which command queries DNS records for domain names?

A

nslookup
nslookup example.com

34
Q

Which command shows the route packets take to reach a network host?

A

traceroute
traceroute google.com

35
Q

Which command shows how long the system has been running since the last reboot?

A

uptime
uptime

36
Q

Which command displays the current logged-in user name?

A

whoami
whoami

37
Q

Which command creates a shortcut for a longer command or set of commands?

A

alias
alias ll=’ls -la’

38
Q

Which command removes an existing alias?

A

unalias
unalias ll

39
Q

Which command displays the manual or documentation for a specific command?

A

man
man ls

40
Q

Which command displays the first few lines of a file?

A

head
head -n 10 file.txt

41
Q

Which command displays the last few lines of a file?

A

tail
tail -n 10 file.txt

42
Q

Which command compares the contents of two files and shows the differences between them?

A

diff
diff file1.txt file2.txt

43
Q

Which command sorts the lines of a file or input in alphabetical or numerical order?

A

sort
sort file.txt

44
Q

Which command removes duplicate lines from a file?

A

uniq
uniq file.txt

45
Q

Which command counts the number of lines, words, and characters in a file?

A

wc
wc file.txt

46
Q

Which command reads input and writes the output both to a file and the terminal?

A

tee
echo ‘text’ | tee file.txt

47
Q

Which command constructs and executes commands using input from standard input?

A

xargs
echo ‘file1 file2’ | xargs rm