Search This Blog

23 July, 2016

ubuntu showing menu always

15.04 and baove has the ability to toggle the global menu as well as the local integrated menus (Via System Settings - Appearance - Behaviour tab) to be permanently on or off.

If you are running a fully up-to-date version of 14.04, this same ability has been backported.

To switch on permanently:

gsettings set com.canonical.Unity always-show-menus true

To switch off i.e. to autohide:

gsettings set com.canonical.Unity always-show-menus false

24 June, 2016

Highlighting or making prominent the active Terminal tab in Ubuntu Linux

For highlighting or making prominent the active tab of the Terminal in Ubuntu Linux

 create a file named ~/.config/gtk-3.0/gtk.css

and paste the below content, You can change the color as you want. Hope this helps


TerminalWindow .notebook tab:active {
    background-color: #b0c0f0;
}


31 March, 2016

git drop all local changes and commit and sync to remote server

There are times while working with git, you want to drop all your local changes and commit and sync the files to be same as the git server. The steps to follow are
1) fetch the latest history from the server
2) pointing your local master branch at it like this

git fetch origin
git reset --hard origin/master

if you want to do this for a branch, change the master with the branch name

18 February, 2016

Android Showing IP address and Route Table

For checking the IP address and Routing Table in Android using command line mode in the linux console is below. For this you need to root the device or it should be engineering build which engineers use for development.

To Show IP Address, MAC address and Interface Status
Type  netcfg  or ip addr

To See The Routing Table
cat /proc/net/route   OR   ip route show

To show DNS IP Addresss
getprop net.dns1
getprop net.dns2

net.dns1 for the Primary DNS and net.dns2 for the Secondary DNS

For changing the DNS IP Address:
setprop net.dns1 111.111.111.111
setprop net.dns2 222.222.222.222




18 September, 2015

end of line sequences in different OS

end of line sequences
Windows end of line sequence:  \r\n
Unix end of line sequence: \n
Mac end of line sequence: \r

11 September, 2015

Recovering moved or deleted files in Linux

I was developing one C program which I spend 1 day writing with around  500 lines of code in Ubuntu 12.04 

for compiling in GCC, I used the below command

# gcc server.c -o server.c

instead of giving gcc server.c -o server 

now my whole source code was replaced with the binary file :( :(  , a simple mistake which caused my whole source code got deleted or replaced. I had a habit of pressing for auto completing the file names. 

After searching for some time googling, i got a solution which worked for me and saved my 9 hours of work.

I got the help form this below link
http://www.cyberciti.biz/tips/linuxunix-recover-deleted-files.html

repeating what is said there and which i tried and worked for me

in the console with sudo permission
sudo grep -a -B[size before] -A[size after] 'filename or unique content' /dev/[your_partition] > file.txt

-i : Ignore case distinctions in both the PATTERN and the input files i.e. match both uppercase and lowercase character.
-a : Process a binary file as if it were text
-B Print number lines/size of leading context before matching lines.
-A: Print number lines/size of trailing context after matching lines.


my command was
sudo grep -a -B10 -A1000 'UNIQUE_SERVER_IP' /dev/sda1 > file.txt

UNIQUE_SERVER_IP was the #define i did it in my source code. After the command is over, open the file.txt with vi or any text editor and search for the string 'UNIQUE_SERVER_IP'. you should find your source code around the string, copy paste and save to the required file name

I got the my source code back in some time.



09 September, 2015

counting number of lines in c and include files in Linux

After writing source code in Linux, if you want to count the number of lines in .c and .h files

find . -name '*.c' -o -name '*.h' | xargs wc -l

tmux enabling mouse interaction

Add the below line to the ~/.tmux.conf setw -g mouse on save the file and exit from the tmux shell, you should be able to use your mouse to ...