Some Basic Linux Commands For Beginners
show the current user.
show the system date.
clear the terminal output.
Display file’s contents to the standard output.
show manual for the command
“man firefox” or “man cd”
change to home 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;
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.
The “~” represents the home directory, you can put paths relative to the home directory like
Move to the parent directory of the current directory.
Print the full filename of the current working directory
List the current directory content
List the current directory content with additional info like the owner, last edit, permissions.
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
Delete a file or folder(-r argument).
Create a folder
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
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.