It is not required to know a lot about Linux to use it. You can use it invisibly every time you do a search on the Internet or use your smartphone. That is what most people do anyway and there is nothing wrong with it. However, if you decided that you want to know more, you want to explore it, maybe you simply need Linux to deploy your program on the server or to get that dream job of yours. Here are 10 commands you will use on daily bases as software engineer, not even talking about DevOps they eat Linux for breakfast.
- cd – change the current directory command used to navigate to other directories on file system. Some examples:
- cd /var/log – would open log directory
- cd – opens top level directory for the user in /var/log case we would go to “~” directory
- cd .. – returns to parent directory in /var/log case we would go back to /var
- pwd – print working directory command. For example if we are in /var/log directory pwd command would print “/var/log” to a terminal.
- ls – list all files in current directory command. This one is quite self explanatory.
- sudo – the one command to rule them all. It stands for “super user do!”, runs command with super users permissions, be really careful with this one if you don’t know what you are doing. You might upset your DevOps team;)
- cat path/to/your/file – command to print the content of the file to a terminal. Good if you just want to check some configuration of a program.
- tail -f path/to/your/file – this one will be your best friend while debugging. It sets listener on selected file (usually log file). Some examples:
- tail -f /var/log/yourProgram.log – sets listener at the end of the fail and everything what is written to a file gets printed to a terminal.
- tail -200f /var/log/yourProgram.log – same a previous one sets listener at the end of the fail and everything what is written to a file gets printed to a terminal, but it takes last 200 lines which are already in the file and prints it a well.
- tail -f /var/log/yourProgram.log | grep “my horrible error” – same as previous two set a listener, but it pipes output of the file though grep pipeline filter prints only lines which includes text in double quotes. Very useful when you know for what you are search in the logs.
- rm path/to/your/file – command to remove/delete file or directory. But sometimes if your directory ins’t empty Linux might warn you or stop the deletion in that case you can use rm -rf path/to/your/file – it tells Linux that you know what are you doing and that its ok to remove file or directory with “force”. But if even that wont help and you really want to delete these files you can relay on “secret” command to clear all errors: sudo rm -rf path/to/your/file
- mkdir nameOfADirectory – make directory command is self explanatory as well is used to create new directories on a file system.
- cp /copy/your/file/from /copy/your/file/to – copy command copies one or multiple files from selected directory 1 to selected directory 2.
- mv path/to/your/file path/to/your/file – move command moves one or multiple files from selected directory 1 to selected directory 2.
There is many more, but these ten should be enough to get you started and as they say if you want how to ride a bike you can read all the books about it in the world, but you won’t learn it until you actual try. So go on take some cheap hosted WM and explore, if it breaks you can always delete it.