Had you ever got tired of having to wait for an app to load to execute a simple task? Or got too many folders and things to access and got yourself lost on the way? Learn how to use command line interfaces (or CLIs) might be of a big help for you. On a console or in a terminal in a computer you can easily type instructions using specific syntax, or commands, to order the computer to quickly do what you have in mind.
For example, let’s suppose you simply wants to know the answer for 1.549 + 2.615, you could open the calculator app on your computer or just type on the terminal print(1.549 + 2.615).
Working through a terminal is faster and you can keep things more organized than using multiple tabs and apps. Knowing that, in this article, I shall present you with a briefly, but useful, example of syntax of command lines.
The ls command lists the non-hidden contents of the current directory.
The ls -a command lists all the contents of the current directory.
The cd command is used to navigate through the directories.
The cd .. command returns you to the parent directory of your current directory
The cd /path to the directory/ command takes you to a specific directory
The mkdir name_directory command creates a new directory called name_directory.
The rmdir name_directory command deletes an empty directory called name_directory.
The cp name_file command makes a copy of a specific file.
The mv name_file name_directory command moves a specific file to a specific directory.
The sudo other_command command runs a specific command you typed with superuser privileges.
The whatis other_command command gives you information about a specific command you typed.
The man other_file command gives you access to the manual of an executable specific file you typed.
The help other_command command gives you access to the manual of a built-in specific command you typed.
The file_name: head -n 20 file_name command shows you the firsts 20 rows (for example) of the specific file you typed.
The file_name: tail -n 20 file_name command shows you the lasts 20 rows (for example) of the specific file you typed.
The file_name: wc file_name command counts number of lines, words and characters in the specific file you typed.
Conclusion
These were the most useful command lines that I learn, and decided to share, by studying through the Dataquest platform.
暂无评论内容