In ubuntu system, we can open the terminal to do some command operations, and then manage the files through commands. Following, we will introduce basic linux commands so that we can start to operate this system.

1. ls (list)

Use this command to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a”. Also, you can only show all text files by using the command “ls *.txt”.

2. cd (change directory)

Use the this command to go to a directory. For example, if you are in the home folder, and you want to go to the documents folder, then you can type in “cd Documents”. Remember, this command is case sensitive, and you have to type in the name of the folder exactly as it is. To go back from a folder to the folder before that, you can type “cd ..”. The two dots represent back.

3. pwd (print work directory)

To know which directory you are in, you can use the this command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash(/). The user directory is usually something like “/home/username/”.

4. mkdir (make directory)

Use this command when you need to create a folder or a directory. For example, if you want to make a directory called “Test”, then you can type “mkdir Test”. If you want to create a directory named “Just A Test”, then you can type “mkdir Just\ A\ Test”.

5. cp (copy)

Use this command to copy files through the command line. It takes two arguments: The first is the location of the file to be copied, the second is where to copy, such as “cp [source file path] [destination path]”.

6. mv (move files or rename files)

Use this command to move files through the command line. We can also use the mv command to rename a file. For example, if we want to rename the file “old.txt” to “new.txt”, we can use “mv old.txt new.txt”. It also takes the two arguments, just like the cp command.

7. rm (remove files)

Use this command to delete files and directories. Use “rm -r [directory name]” to delete just the directory. It deletes both the folder and the files it contains when using only the rm command.

8. touch

Use this command to create a file. It can be anything, from an empty txt file to an empty zip file. For example, “touch new.txt”.

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...