Command Line - Commands + Clarifiers Flashcards
Which command is used to change directories?
cd
cd /Desktop
Which command creates a new file in the command line?
touch
touch newfile.txt
Which command creates a new directory (folder) in the command line?
mkdir
mkdir myFolder
Which command displays a list of previously entered commands?
history
history
Which command opens files in VS Code from the command line?
code
code example.js
Which command lists the contents of the current directory?
ls
ls -l
Which command copies files or directories?
cp
cp file.txt /newlocation/
Which command moves or renames files or directories?
mv
mv oldname.txt newname.txt
Which command removes files or directories?
rm
rm file.txt or rm -r myFolder
Which command displays the contents of a file?
cat
cat file.txt
Which command shows the current working directory?
pwd
pwd
Which command prints a message or variable value?
echo
echo ‘Hello, World!’
Which command searches for patterns in files?
grep
grep ‘pattern’ file.txt
Which command searches for files and directories based on criteria?
find
find /path -name ‘file.txt’
Which command changes file or directory permissions?
chmod
chmod 755 file.txt
Which command changes file ownership?
chown
chown user:group file.txt
Which command creates or extracts an archive file?
tar
tar -cvf archive.tar file1 file2
Which command compresses files, and which command extracts them?
zip / unzip
zip archive.zip file1 file2 / unzip archive.zip
Which command allows a user to execute commands with superuser privileges?
sudo
sudo apt-get update
Which command displays currently running processes?
ps
ps aux
Which command terminates a process?
kill
kill 1234
Which command shows real-time system processes and resource usage?
top
top
Which command shows the available and used disk space?
df
df -h
Which command shows the disk usage of files and directories?
du
du -sh /directory/
Which commands are used to edit files in the command line?
nano / vim
nano file.txt / vim file.txt
Which command downloads files from the web?
wget
wget http://example.com/file.zip
Which command transfers data to or from a server using protocols like HTTP or FTP?
curl
curl http://example.com
Which command securely copies files between hosts over a network?
scp
scp file.txt user@remote:/path/
Which command synchronizes files and directories between two locations?
rsync
rsync -avz /source/ /destination/
Which command checks the network connection between your machine and a host?
ping
ping google.com
Which command displays network connections, routing tables, and interface statistics?
netstat
netstat -a
Which command configures or displays network interface settings?
ifconfig
ifconfig eth0
Which command queries DNS records for domain names?
nslookup
nslookup example.com
Which command shows the route packets take to reach a network host?
traceroute
traceroute google.com
Which command shows how long the system has been running since the last reboot?
uptime
uptime
Which command displays the current logged-in user name?
whoami
whoami
Which command creates a shortcut for a longer command or set of commands?
alias
alias ll=’ls -la’
Which command removes an existing alias?
unalias
unalias ll
Which command displays the manual or documentation for a specific command?
man
man ls
Which command displays the first few lines of a file?
head
head -n 10 file.txt
Which command displays the last few lines of a file?
tail
tail -n 10 file.txt
Which command compares the contents of two files and shows the differences between them?
diff
diff file1.txt file2.txt
Which command sorts the lines of a file or input in alphabetical or numerical order?
sort
sort file.txt
Which command removes duplicate lines from a file?
uniq
uniq file.txt
Which command counts the number of lines, words, and characters in a file?
wc
wc file.txt
Which command reads input and writes the output both to a file and the terminal?
tee
echo ‘text’ | tee file.txt
Which command constructs and executes commands using input from standard input?
xargs
echo ‘file1 file2’ | xargs rm