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