I know that the terminal may look scary at the beginning but it’s so useful you can do a lot of things like rename files easier than a graphic interface, watch or stop system processes, start or stop system services. Commands are the great way to understand Linux and learn so much about it. In Linux, there exist a lot of commands. The list that I’m presenting here includes the most common Linux commands for beginners. Note: For some commands, you will need administrator permissions(It depends what are you trying to do).
Basic Linux System Commands
|whoami||show the current user.|
|date||show the system date.|
|clear||clear the terminal output.|
|cat <filename>||Display file’s contents to the standard output.|
|man <command>|| show manual for the command|
“man firefox” or “man cd”
|cd||change to home directory|
|cd <directory>|| Change the directory to <directory>|
Note: this must be a relative path, If you are in home and want to go to Desktop you only need to put;
|cd /<directory>|| In linux the “/” represents the root directory is like the C:/ in windows, no matter in what directory you are, if you put ‘/’ all the path must be relative to this.|
|cd ~/<directory>|| The “~” represents the home directory, you can put paths relative to the home directory like|
|cd..||Move to the parent directory of the current directory. |
|pwd||Print the full filename of the current working directory|
|ls||List the current directory content|
|ls -l||List the current directory content with additional info like the owner, last edit, permissions.|
|ls -a|| List current directory content, even the hidden content|
Note: If you want to create hidden folders or files the name needs to start with “.” , Also you can combinate arguments like;
ls -la <- this command shows all the content of the current directory even the hidden content and extra info.
|cp <origin-file-path> <destination-path>|| Copy a file to another location|
Note: Like the cd command you can use a relative path to the current directory, to the home directory(~) or to the root directory(/)
|cp -r <origin-folder-path> <destination-path>|| Copy a folder to another location.|
Note: the argument -r is required to copy, move or remove folders.
|mv <origin-file-path> <destination-path>|| Move a file or folder(-r argument) to another location.|
Note: If you want to rename a file You can use this command, only need to put the original file name and the new file name
mv helloworld.txt helloworld.c
|rm <file-name>||Delete a file or folder(-r argument).|
|mkdir <folder-name>||Create a folder|
|nano <file-name>||Nano is text editor in console, if the <file-name> doesn’t exist nano creates the file and if exist nano opens the file.|
|chmod <777> <file-name>|| chmod is a command that allows you change the permissions for a file or a folder(-r argument),the easiest way it is composed by three arguments the first value is for user permissions, the second for the group and the third for others, the permission for read is represented by a 4, for write is 2 and for execute is 1, the sum of the permissions is equal to 7|
chmod 741 Documents
Basic Process Commands
|ps -a | grep <process-name>|| Give info for some program that is in|
execution like the PID (Process ID).
ps -a | grep firefox
Note: Also you can use the “ps -a” command to see all your system process.
|kill -9 <PID>|| Kill or stop the execution for a process or program|
kill -9 255
|free – < b | k | m >||Show some information about the RAM and swap space usage, the argument is for the size in which the info be displayed, b for bytes, k for kilobytes and m for megabytes.|