Tag Archives: bash

Fish – A user friendly command line shell for Ubuntu/Linux

Fish is a friendly command line shell for Ubuntu/Linux, Mac or any other operating system from the *nix family. If you use bash (the default shell in Ubuntu) often, then you may want to give it a try. It has lots of smart features you may find productive.

fish shell


  • Autosuggestions – It suggests commands when you type, based on history and it’ll often save you some time with the commands you type more often.
  • Scripting – Similar to bash but the syntax is much simple, clean and consistent.
  • term256 – it supports 256 colors.
  • Sane defaults – Most of the features will work just fine without any additional configurations.

Installing Fish in Ubuntu

Fish is already there in official package repository (tested on Ubuntu 14.04 LTS). So, you can install it right away

sudo apt-get update
sudo apt-get install fish

If it’s not available in repository or you’re using other Linux distribution ? Check out official page to download a tarball for your distribution.

To start fish, simply type fish on your terminal and you’ll jump into the fish shell. Type help and it will open the documentation tab (hosted locally) in your default browser. Also read official tutorials to learn more about the features of Fish Shell.


Top 17 Terminal Commands Every Ubuntu user should know About

Terminal Commands are cool and very handy sometimes (even for common users who don’t like terminal), also useful in learning some cool stuffs about Ubuntu or GNU/Linux in general (so it’s also good for learners).

I’ve prepared a list of few terminal commands – that anyone can learn and master (in couple of minutes), in order to enjoy a better experience with Ubuntu or other Linux distributions (and don’t worry about – the Ubuntu version you are using such as – 12.04 LTS – “Precise Pangolin” or 11.10 or may be the upcoming one – 12.10, because it doesn’t change often unlike the other things in Ubuntu :), same for Ubuntu derivatives such as Linux Mint 13(Maya)).


Top 17 commands for Ubuntu Beginners

Basics GNU/Linux Commands

#1. ls : list directory contents


If you want to see hidden files/directories (beginning with dot.), the use -a flag.

ls -a

Check the manual for more detail (man ls).


#2. cd : Change Directory

cd ../
cd /home/Desktop


. represents the current directory

.. represents the parent directory

~ represents the home directory (of the user)


#3. pwd : print the current/working directory



#4. mkdir : make/create directory.

mkdir funny_stuffs


#5. rm : remove/delete file/directory

rm useless.sh

NOTE : it removes directories only if it’s empty, unless you specify -f flag for force deletion. But you must be careful with the arguments such as -r, -f. (-rf is very dangerous).


#6. sudo : superuser do, to gain root privilege


sudo apt-get install gnome-shell

Then enter your user account password, and you would be able to do administrative tasks like root. So if you’re getting any permission error using a command, then adding sudo as a prefix, might help.


#7. mv : rename or move a file/directory

mv file1 ~/Downloads/Archive/

the above command will move the file from the current directory to target directory.

mv logo_2.jpg new_logo.jpg

it will rename the file to new_logo.jpg.


#8. cat : View File contents

cat install.log


#9. man : A Reference manual for utils/commands/programs

e.g if you want to know more about rm command, then type –

man rm


#10. cp : Copy Files/Directories

cp movie_name.mp4 ~/Downloads/movies/

The above command will copy the movie_name.mp4 to the specified directory.


#11. wget : Download files from server

GNU Wget or wget is very handy in downloading stuffs from internet, over the command line.

wget url_of_the_content


#12. gksudo : Run GUI Application with Root privilege

gksudo nautilus

The above command will open nautilus with root privilege. It’s just like sudo, but in GUI mode.


#13. shutdown : To shutdown the computer from terminal

shutdown -h 

where time can be 0 if you want to shutdown now or specify the exact time such as 10:30.


#14. restart : Restart the computer


Package Management

These are Ubuntu Specific commands. It Requires root privilege, so just add the sudo prefix before each command (it will ask for the user password and you’re done!).

#15. apt-get : Command Line Tool for handling packages
There are various options such as

install – To install package.
e.g Install the program PyRoom (A distraction Free Text Editor)

sudo apt-get install pyroom

remove – To remove package

sudo apt-get remove kate

update – To update the package cache

sudo apt-get update


#16. add-apt-repository – To add a PPA (for your favorite Application)

e.g add the PPA for the App Eidete (Screencasting program)

sudo add-apt-repository ppa:shnatsel/eidete-daily

After, adding the PPA, apt-get update command is required.


#17. apt-cache : To access the Package details from cache

search : search for the related packages in the apt-cache

apt-cache search image editor

What is sudo in Ubuntu?

Sudo commands in linuxIn early days it was difficult to manage the permissions for different users in a multiuser operating system that may be a client or server;suppose every user has a power of a superuser or root then any one of them may be misused the system either intentionally(If the user is smart) or ignorantly(If the user is a beginner one).Hence the simple solution of this problem is to limit the power for every users according to their need so that they can do simple tasks normally but in case of any administrative task root power is granted for small period(usually five minutes)by using the sudo commands.In sudo su stands for superuser and do means do(as usual).Hence sudo is mostly used by a permitted user for taking the permission to execute some commands as a another user or superuser, according to the information specified in sudoers file.Suppose the user that is invoking a command using the sudo power, is root then there is no need to enter user password.By default authentication is required and the user password is required; the user may use the sudo power again for short period of time(5-15min).So sudo is very useful in finishing some administrative task by a simple user.Now we are going to learn something more about the sudo commands.

Syntax of the sudo commands :

It is very simple..just use the word sudo before the actual command and hit enter.Then it will ask for the users password ..enter the password after the authorization process the commands will execute.e.g I am trying to execute commands1(installing a package using apt-get).

user840@user840-desktop:~$ sudo commands1
[sudo] password for user840:
Reading package lists… Done
Building dependency tree
Reading state information… Done

….and so on the execution will complete.

Options in SUDO :

-A : Using this option the another helper program(It may be in graphical format) is called and executed to read the password of the user and output the user password to the canonical output.

-u user : this option tells the sudo to run the target command as a user instead of root(which is default case).You may use UID rather than username by using UID followed by ‘#’.i.e #uid.
-a : It is used by the sudo to use the special authentication type for the validation of the user according to the permission settings stored in /etc/login.conf.
This option is is used only in the system having the support with BSD authentication mechanism.

-b : Specifying -b(background) with the sudo command simply means to order the sudo that “run the target command in background”.

-p prompt : By using -p (prompt) one can easily customize the password prompt.So using some ‘%’ escapes(e.g %H,%h,%p) you may use any other prompt rather then the default one.

Although there are many other options available but you can easily find out in your bash shell.just type info sudo and hit enter.

Environment Variables :

here are the some environment variables used by the sudo.

USER : Set to the current user.By default its value is equal to root if -u option is not specified.

SUDO_UID : user ID of the user who used the sudo.

SUDO_USER : Set to the login of the permitted user who is using sudo.
Go to your bash terminal for the details about the more environmental variables(info sudo OR man -k sudo OR help sudo).

Credit : Todd C. Miller

Learning Bash-Shell Commands-Tutorial-3

1. mv command : It is used for file from one directories to another.You have to first enter the file_name(that you want to move) and then
the new location of that file.
SYNTAX : mv filename new_location
rk10@rk-desktop:~/Desktop/log$ ls
rk10@rk-desktop:~/Desktop/log$ cd ../
rk10@rk-desktop:~/Desktop$ cd test
rk10@rk-desktop:~/Desktop/test$ ls
login.txt  xyz.txt
rk10@rk-desktop:~/Desktop/test$ mv login.txt /home/rk10/Desktop/log
rk10@rk-desktop:~/Desktop/test$ cd ../log
rk10@rk-desktop:~/Desktop/log$ ls
login.txt  passwd.txt

2. mkdir commmand : It is used for creating new directories.You have to just specify the name of the directory after mkdir,it will create a directory in the current working directory.
SYNTAX : mkdir : mkdir new_directory
rk10@rk-desktop:~/Desktop/log$ ls
login.txt  passwd.txt
rk10@rk-desktop:~/Desktop/log$ mkdir eagle
rk10@rk-desktop:~/Desktop/log$ ls
eagle login.txt  passwd.txt

3. less command : Its works as a text reader because it can display text files contents.
SYNTAX : less file_name.txt
rk10@rk-desktop:~/Desktop/log$ less login.txt //press CTRL+Z to come back to command promopt.
this is the content of the file login.txt….
[1]+  Stopped                 less login.txt

4. stat command : It is very usefull in veiwing file statistics,e.g creation date,modification date etc.stat command gives the complete status of the file.
SYNTAX : stat file_name
rk10@rk-desktop:~/Desktop/log$ stat login.txt
File: `login.txt’
Size: 37 Blocks: 8          IO Block: 4096   regular file
Device: 808h/2056d Inode: 1024062     Links: 1
Access: (0644/-rw-r–r–)  Uid: ( 1000/rk10)   Gid: ( 1000/rk10)
Access: 2010-03-14 19:31:46.000000000 +0530
Modify: 2010-03-14 19:31:25.000000000 +0530
Change: 2010-03-14 19:31:25.000000000 +0530

Learning bash-commands- tutorial-2

An easy way to learn linux commands-tutorial-2
1. pwd command : To see the current working directory use pwd command.
SYNTAX : pwd
rk10@rk-desktop:~$ pwd
#For more information on cd command just type help cd ,in your bash shell.
2. cp command : It is used for copying the files from one directory to another.Here I am copying the file xyz.txt from home directory to the desktop.
SYNTAX : cp filename destination
rk10@rk-desktop:~/Desktop/test$ ls            #test directory is empty at this time
rk10@rk-desktop:~/Desktop/test$ cd ../
rk10@rk-desktop:~/Desktop$ cp xyz.txt /home/rk10/Desktop/test
rk10@rk-desktop:~/Desktop$ cd test
rk10@rk-desktop:~/Desktop/test$ ls
3. ls command : It is used to display the files and sub directories in the current working directory.
rk10@rk-desktop:~/Desktop/security$ ls
black_listed_IP  firestarter-events.txt  my_id
dns1.txt                netstat_1.txt
4. rm command : It is used to delete the file,but note that the files will be deleted permanently.
SYNTAX : rm filename
rk10@rk-desktop:~/Desktop/test$ ls
rk10@rk-desktop:~/Desktop/test$ rm abc.txt
rk10@rk-desktop:~/Desktop/test$ ls