Basic Command Line Tutorial

Basic Command Line Tutorial

Directory means folder.

Command:

pwd - print working directory

pwd

This command will display the current directory or folder we are currently in.


Command:

ls - list

ls

This command will give us a list of contents inside our current folder.


Command:

clear - clear terminal window

clear

This command will give us a clean slate and removes all the previous commands and outputs.


Command:

mkdir - make directory

mkdir "command line practice"

This command, followed by the name of a folder, will create a new folder.


Command:

cd - change directory

This command will change current directory/folder.

cd "command line practice"

This command will take us to the "command line practice" folder


Create a new file

Command:

touch - create a new file

 touch "command-line-cheat-sheat.txt"

This command will create a new file named "command-line-cheat-sheet.txt" within the current folder.


Navigate up one level

Command:

cd ..

cd ..

This command will move you up to the parent directory of the current directory.


Remove a file

Command:

rm - remove

rm "command-line-cheat-sheet.txt"

This command will permanently delete the file "command-line-cheat-sheet.txt" from the folder.


Remove a folder with all its contents

Command:

rm -r "command line practice"

This command will remove the folder along with its contents.

In the example provided, "command-line-cheat-sheet.txt" is the name of the file to be removed. After executing this command, the specified file will be permanently deleted from the folder.


Move a file or rename a file

Command:

mv - move

mv oldName.py newName.py

This command can be used to rename files or folders by specifying new names.

mv newName.py /path/to/destination/

It can also be used to move a file to a new destination.


Copy files to a different folder

cp filename /path/to/destination

This command will copy the file named "filename" to the specified destination.

That's all for now, folks. Thank you for reading :)