Skip to main content
1. Commands for navigating directories
ls
is the command for listing files in a directory
ls -a
will display all files including hidden files within a directory
ls -al
will display all files + hidden files and their permissions
pwd
Abbrv. for Print Working Directory - it will output the aboslute path of directory you're in
cd /home/kvis
is the command for changing directory to /home/kvis
- Typing
cd
alone, will go to the user's home folder
cd ..
will move a level up like a back button
cd -
will return to the previous directory you were in
cp file_to_copy.txt new_file.txt
will copy file_to_copy.txt
and make a new file with the same contents in the same directory called new_file.txt
. First argument is always the source and the second argument is always the destination
cp -r dir_to_copy/ new_copy_dir/
is used to copy entire directories. You must use the -r
flag (recursive flag) in order to copy a dir and everything within it
rm file_to_copy.txt
will delete the file
rm -r dir_to_remove/
will delete an empty directory
rm -rf dir_with_content_to_remove/
will delete a directory and the data within it as well! BE CAREFUL with this command
mkdir images/
will create an empty directory called images
mkdir -p movies/2004/
will create movies
directory along with an unlimited amount subdirectories beneath it.
touch new_file.txt
will create a new empty file called new_file