Command Line Interface/Commands (I) Flashcards
which shell am I using?
echo $SHELL
send text to the CLI’s output
echo “hello, everyone”
change your current directory
cd _______
(name of/path to the directory you want to change
to)
open the manual to get info on a command
man ________
(name of command you want to look up)
send text to the CLI’s output AND have cursor appear on same line as the output
echo -n “Hello, everyone”
find out where you currently are in the file system (which directory you are in)
pwd
leave/close the manual
q
move a file from your current directory to another directory
mv _________ _______
(which file?) (destination)
mv jobs.txt ../..
create an empty file
touch _________
(name/extension of file)
create a new directory
mkdir ___________
(name of directory)
go to the home directory (three ways to do it)
cd
cd ~
cd $HOME
go to the root directory
cd /
list all the files and sub-directories in a folder
ls ___________
(name of folder)
list all the files and sub-directories in a folder AND have more info shown AND have everything in an easier-to-read format
ls -lah ____________
(name of directory)
rename a file
mv ________ __________
(old name) (new name)
move a file from your current directory to another directory and change the name of the file
mv __________ _________/_____
(which file?) (path to new directory/new name)
move a file from a directory to your current directory (keep the same name for the file)
mv ______________ ____________
(path/name of file) ( . OR ./ )
copy a file in your current directory
cp __________ __________
(which file?) (new name)
You have to give it a new name. You can’t have two files with the same name in the same directory.
copy a directory and all its contents
cp -r _____________
(name of directory)
copy a file in your current directory and move it to another directory (give it a new name)
cp ___________ ________/_______
(which file?) (path to destination/new name)
Go up two levels from your current directory and copy a file. Next, move that file to the directory one level above your current directory. Don’t change the name of the file.
cp ../../filename ../
delete a file from your current directory
rm _________
(which file?)
delete a folder and all its contents (files and sub-directories)
rm -r ____________
(name of folder)
copy just the contents of a folder (but not the directory)
cp _________/*
(folder name)
print out the contents of a file
cat _________
(name of file)
remove/delete a directory
rmdir __________
(name of directory)
the directory has to empty of files and sub-directories before you can delete it