[vc_row][vc_column width=”1/1″][vc_column_text]
Basic Terminal Operations
- Changing Directory
-
- The command for changing directory is
cd
- You can go to the top of your file system by typing
cd /
. Any directory change starting with / will be relative to the top directory in the file system. Typingcd folder/subfolder
, etc. will change directory relative to were you are now in the filesystem (the working directory), so, for example, if you are in the home directory, and you typecd arduino
you will go into the directory home/arduino, but if you had instead typedcd /arduino
, Linux would have tried to put you in an arduino directory at the top level of the file system (similar to C:\arduino on windows), which on most systems won’t exist.
- The command for changing directory is
- Listing Files in a directory:
-
- To do this, type
ls
. - This function ‘lists’ all the files in a directory. Adding -a to the command (
ls -a
) will also show any hidden files in that directory. Adding -l (ls -l
) will show the file’s permissions, type, owner and the date it was created/edited.
- To do this, type
- What the heck is ‘sudo’?
-
- root is the super user (administrator) on Linux. Sudo is the command which allows other users to issue a command as the super user. sudo = “super user do”. Operations that a normal user aren’t normally allowed to do can be done using sudo. The word is just a mash of super-do and pseudo. USE SUDO WITH CAUTION! Sudo can be used to do a lot of damage to your system, and there is often a reason your normal account isn’t allowed to perform a certain action.
suro rm -rf /*
would completely delete everything in the filesystem, destroying the system.
- root is the super user (administrator) on Linux. Sudo is the command which allows other users to issue a command as the super user. sudo = “super user do”. Operations that a normal user aren’t normally allowed to do can be done using sudo. The word is just a mash of super-do and pseudo. USE SUDO WITH CAUTION! Sudo can be used to do a lot of damage to your system, and there is often a reason your normal account isn’t allowed to perform a certain action.
- What is apt-get?
-
- Apt-get is the package or software manager on Debian/Ubuntu linux. Install is the operation for apt-get to perform and the name of the package follows the keyword or action of install. i.e. nedit Multiple package names can be put on the line following install.
- How to check kernel version
-
ubuntu@ubuntu:~$ cat /proc/version
- How to Uninstall / Delete / Remove Package
-
- To list all installed packages:
- dpkg –list
- sudo apt-get –purge remove lighttpd
- How to check storage space left
-
- To check space left
- $df -h
[/vc_column_text][vc_tour][vc_tab title=”Compress and Decompress” tab_id=”1388199308-1-28″][vc_column_text]Assume you are on a text console, and you would like to zip up a folder at your current directory say “abcfolder”, simply run the following command:
$tar czvf myfolder.tar.gz abcfolder/
To compress all the files within a folder:
$tar czvf allmyfiles.tar.gz *
Extracting is probably quite easy. If you have a .tar.gz file, simply type the command to extract all the files and folders to the current folder you are in.
$tar -zxvf extractme.tar.gz
If you have a file with ends with tar.rar. We can install the rar utility by:
$sudo app-get install unrar*
We can then decompress by using ‘$unrar filename.tar.rar’.
For a file ends with tar.bz2, we can do
$tar jxf filename.tar.bz2
[/vc_column_text][/vc_tab][vc_tab title=”Slide 2″ tab_id=”1388199308-2-24″][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.