Some useful tips while working under GNU Bash – part 1

ImageGiven below are some typical commands used in bash environment under a variety of circumstances. Check out the listing and I am sure everyone who reads this will be benefited from at least one of the following…
[1] du utility command
You can use the du utility to estimate file space usage. For example,
user@GNULinux:~$ du -sh /home/user/photorec.ses
    40K    /home/user/photorec.ses
    
-s for summarizing and -h for making the displayed size human readable. Look at another example,

user@GNULinux:~$ cd /home/
    user@GNULinux:/home$ du -sh *
    2.1G    user

[2] Freeze a process temporarily using ID
Read More »

Change the host/computer name and bluetooth name in GNU/Linux

Hostname is the computer name, usually displayed in user@hostname format after login. This hostname is the name you gave during the installation of the GNU/Linux i.e, the computer name. Most of us wish to change this name afterwards. Here is a simple way described to perform the action.

1. sudo nano /etc/hostname
2. Just replace the whole thing i.e, the present hostname with the new one.
3. Save the file
4. sudo nano /etc/hosts
5. Edit the second line starting with 127.0.1.1 by replacing the current hostname with the same one you entered in /etc/hostname.
6. Save the file and logout.

During the next login changes will be made.

Another important thing is about the bluetooth name visible to others during file transfer. In Ubuntu I think the default name is ‘ubuntu-0’. Don’t you feel shame to have such a bluetooth name? It is your freedom to set a name of your own. That’s the power of GNU/Linux. Don’t worry at all. GNU/Linux is also capable of changing this name too. For the change to come true,

1. cd /var/lib/bluetooth
2. There will be a directory with your bluetooth device MAC address (Most probably only that will be the only one inside this directory). Get into
that directory.
3. sudo nano config
4. Substitute the perefered name adjacent to ‘name’ written as the first line.
5. Save the file.
6. Restart the bluetooth by sudo service bluetooth restart.

Now you can have that name in the bluetooth settings and accordingly as the public visible name.

Remove the history of commands in GNU/Linux shell

Image

For most of the linux users history of commands in shell is a grace. Up/Down arrow
keys help them to find the previously executed commands.But for someothers it may
be a curse.There are situations in which you don’t need to reveal previously used
commands in linux terminal, especially when your system is being used by others.

Linux provides an easy method for removing the history of used commands. Keep it
safe and simple by editing the .bashrc. It is hidden by default in the home folder.

1. Open .bashrc in shell by nano .bashrc
2. Move to the line where
HISTSIZE=10
HISTFILESIZE=200
is written.
3. Edit the numbers to look like
HISTSIZE=0
HISTFILESIZE=0
4. Now you can logout and check the changes made
by pressing the Up/Down arrow keys.