Basic Linux commands for working with Files
echo
This command is used to print whatever you write followed by command echo
example
echo Hello, this will print "Hello" on the terminal
ls
This command will list all the files and directories in a folder
syntax - ls Directory_name
mkdir
This command is used to create a new directory
syntax- mkdir Directory_name
mkdir -p
Used to create directory tree in one go
syntax- mkdir -p /home/a/b/c
This will create a directory tree like directory a > directory b > directory c
touch
This is used to create an empty file
syntax- touch file_name
cp
This command is used to copy a file to another file
syntax- cp source_file_name target_file_name
mv
This command is used to move file from one location to another location
syntax- mv source_file_location target_file_location
rm
Used to delete any file
syntax- rm file_name
cd
Change directory
syntax- cd location_of_directory
cd ..
This is used to go back to the previous directory
syntax- cd ..
cat
To view contents of a file
syntax- cat file_name
rm -r
To delete a directory and its content
syntax- rm -r directory_location or rm -r directory_name
cp -r
To copy one directory from one location from one location to another
syntax- cp -r source_directory_location target_directory_location
mv
To move a file from one location to another
syntax- mv source_file_location target_file_location
whoami
This will display which user is currently accessing the cli
id
Display more info about the user example user_id , group_id
su
It stands for switch user
syntax- su user_name_you_want_to_switch
sudo
This will provide the root level access to the user, that is all the permissions will be given to the user