Category: Linux

[HowTo] change from OEM installation to normal user mode?

Last week, I have installed Ubuntu 16.04 on my Laptop alongside Windows 10 and chose OEM install during the installation just to try what it is up-to. Later, I learnt that OEM mode is a System Manufacturer Mode and choosing this would allow one to customise the OS before shipping to the end-users. This is definitely what I intended to do as a direct end-user. I, therefore, wanted to revert it to the normal user mode and this is how I did in just 1 step.

— Double click on “Prepare for shipping to the end user” icon in the Desktop. Upon rebooting, you will be asked for your preference (including name and username) and voila! you can login as a normal from then-on..
ubuntu OEM install

How to fix Wifi connectivity issues with WPA & WPA 2 Enterprise on Ubuntu 13.10

After the upgrade to Ubuntu 13.10, I was able to connect to my home wifi, but not my office one. I realised Ubuntu has issue is with only “WPA & WPA 2 Enterprise” type authentication. On Googling, I came across this stackoverflow post to be closely relevant. However, I fixed the following way. Delete the faulty connection from list in Network Connections.

$ locate MyWifiName /etc/NetworkManager/system-connections/MyWifiName

Open the above file as a root user and remove the below line and retry connecting. It works!

system-ca-certs=true

and you’re welcome 🙂

How to take a screenshot of a portion of the screen in Ubuntu

Taking a screenshot is as simple as pressing PrintScreen button and finding it saved in ~/Pictures directory. This gets awfully tough when we have a multiple screen setup and wanted to take just a part of the image. I used to manually crop the required portion using an image editor (like Shotwell, yes you heard it right).

It was just today I discovered that there is an option to take a screenshot of just a portion of your scrreen by pressing Shift+PrintScreen combination. You may press ALT+PrintScreen for a screenshot of the current active Window. This gives us a plus cursor to highlight/choose just a portion of a screen and once done highlighting, release the cursor.. and voila! that’s it 🙂

This is one such incredible hack for those multiscreen users like me!

Install offline GIT Web help !

Today, I realised there is a HTML version of offline help manual available for GIT while running the following command.

$ git help –web grep

But then I realised the local HTML docs were not installed, when I tried to run. Thus running the following command gets it working.

$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git /usr/share/doc/git-doc

Updating the docs is just a command away.

$ cd /usr/share/doc/git-doc
$ sudo git pull

The following are few of the important links that comes handy (as mentioned in man git).

NOTES

1. Everyday Git

file:///usr/share/doc/git-doc/everyday.html

2. Git User’s Manual

file:///usr/share/doc/git-doc/user-manual.html

3. git concepts chapter of the user-manual

file:///usr/share/doc/git-doc/user-manual.html#git-concepts

4. howto

file:///usr/share/doc/git-doc/howto-index.html

5. GIT API documentation

file:///usr/share/doc/git-doc/technical/api-index.html

What is the difference between >> and 2> – Standard Input and Output Redirection explained

Off late I happen to get used to a lot of I/O redirection involved in coding and executing commands. Thus I thought summarizing them as a blog for my own reference.

The shell and many UNIX commands take their input from standard input (stdin), write output to standard output (stdout), and write error output to standard error (stderr). By default, standard input is connected to the terminal keyboard and standard output and error to the terminal screen.

The way of indicating an end-of-file on the default standard input, a terminal, is usually <Ctrl-d>.

Redirection of I/O, for example to a file, is accomplished by specifying the destination on the command line using a redirection metacharacter followed by the desired destination.

C Shell Family

Some of the forms of redirection for the C shell family are:

Character Action
> Redirect standard output
>& Redirect standard output and standard error
< Redirect standard input
>! Redirect standard output; overwrite file if it exists
>&! Redirect standard output and standard error; overwrite file if it exists
| Redirect standard output to another command (pipe)
>> Append standard output
>>& Append standard output and standard error

The form of a command with standard input and output redirection is:

% command -[options] [arguments] < input file > output file 

If you are using csh and do not have the noclobber variable set, using > and >& to redirect output will overwrite any existing file of that name. Setting noclobber prevents this. Using >! and >&!always forces the file to be overwritten. Use >> and >>& to append output to existing files.

Redirection may fail under some circumstances: 1) if you have the variable noclobber set and you attempt to redirect output to an existing file without forcing an overwrite, 2) if you redirect output to a file you don’t have write access to, and 3) if you redirect output to a directory.

Examples:

% who > names
Redirect standard output to a file named names
% (pwd; ls -l) > out
Redirect output of both commands to a file named out
% pwd; ls -l > out
Redirect output of ls command only to a file named out

Input redirection can be useful, for example, if you have written a FORTRAN program which expects input from the terminal but you want it to read from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout:

% myprog < myin > myout

You can suppress redirected output and/or errors by sending it to the null device/dev/null. The example shows redirection of both output and errors:

% who >& /dev/null

To redirect standard error and output to different files, you can use grouping:

% (cat myfile > myout) >& myerror

Bourne Shell Family

The Bourne shell uses a different format for redirection which includes numbers. The numbers refer to the file descriptor numbers (0 standard input, 1 standard output, 2 standard error). For example, 2> redirects file descriptor 2, or standard error. &n is the syntax for redirecting to a specific open file. For example 2>&1 redirects 2 (standard error) to 1 (standard output); if 1 has been redirected to a file, 2 goes there too. Other file descriptor numbers are assigned sequentially to other open files, or can be explicitly referenced in the shell scripts. Some of the forms of redirection for the Bourne shell family are:

Character Action
> Redirect standard output
2> Redirect standard error
2>&1 Redirect standard error to standard output
< Redirect standard input
| Pipe standard output to another command
>> Append to standard output
2>&1| Pipe standard output and standard error to another command

Note that < and > assume standard input and output, respectively, as the default, so the numbers 0 and 1 can be left off. The form of a command with standard input and output redirection is:

$ command -[options] [arguments] < input file > output file 

Redirection may fail under some circumstances: 1) if you have the variable noclobber set and you attempt to redirect output to an existing file without forcing an overwrite, 2) if you redirect output to a file you don’t have write access to, and 3) if you redirect output to a directory.

Examples:

$ who > names
Direct standard output to a file named names
$ (pwd; ls -l) > out
Direct output of both commands to a file named out
$ pwd; ls -l > out
Direct output of ls command only to a file named out

Input redirection can be useful if you have written a program which expects input from the terminal and you want to provide it from a file. In the following example, myprog, which was written to read standard input and write standard output, is redirected to read myin and write myout.

$ myprog < myin > myout

You can suppress redirected output and/or error by sending it to the null device/dev/null. The example shows redirection of standard error only:

$ who 2> /dev/null

To redirect standard error and output to different files (note that grouping is not necessary in Bourne shell):

$ cat myfile > myout 2> myerror

 

P.S. This works the same way in all operating system and is universal.

Courtesy : http://www.mathinfo.u-picardie.fr/asch/f/MeCS/courseware/users/help/general/unix/redirection.html

Linux File System Hierarchy

Do you need to know the file system hierarchy. You don’t have to search in Google to get familiarized with it. It’s there within your distro. Yes, Just type the following command to list the manual containing a detailed information about the file system hierarchy.

$ man hier

Playing around with fbcmd [HOWTO]

This post has been lying around my Drafts for about a month. While I was looking for ways to find mutual friends between two persons in Facebook, I realized that it is a painful job which involves a lot of playing around with Facebook API’s to get mutual friends listed. Whereas finding Mutual friends in Twitter is quite simple and so does with Identica too. You may find how to find them in this blog.

Let’s see how to achieve this..

1. Install fbcmd as per the blog post

2. Open your terminal and type the following to find mutual friendship between you and your friend

$ fbcmd mutual “<Enter_your_friend’s_full_name_within_quotes>”

For Example :

$ fbcmd mutual “vigneshwaran Raveendran”

NAME                     FRIEND_NAME

Vigneshwaran Raveendran  Kashi Vishwanath Revathy Ganesan

Karthikumar SK

Dhameswaran Natarajan

Mohindar Amarnath

Kamesh Jayachandran

[snip]

Isn’t that awesome. The following are a few commands that I felt it interesting..

How to list [and optionally save] all your friend’s profile photos ?

$ fbcmd ppics =all /tmp/fbcmd/ppics/

How to list [and optionally save] all photos where friend(s) are tagged

$ fbcmd fpics

How to list any friends who are currently online

$ fbcmd fonline

How to export all your friend’s B’day date in csv format ?

$ fbcmd finfo birthday_date -csv

How to know your profile ID ?

$ fbcmd whoami

How to set your status update
$ fbcmd status “is excited to play with fbcmd”
What not? Start playing with this app
$ fbcmd help #is your friend..
With this application, you can even schedule for a list of status updates with the help of a cron job 🙂
for additional help, examples, parameter usage, flists, preference settings,
visit the FBCMD wiki at:

[HOWTO] Enable Maximize, Minimize buttons on the title bar in Gnome 3

Though there are many blog posts available to show how to enable Maximize, Minimize buttons on the title bar in Gnome 3, this post is for my personal reference ;).

As you know, there will be no title bar controls for minimize, maximize/restore. To enable them, open up the terminal and type in (or copy/paste) the following command:

I prefer the buttons to be in right corner.

gconftool-2 –set /desktop/gnome/shell/windows/button_layout –type string :minimize,maximize,close

Now, press Alt+F2, type in “r” without quotes and press enter. This will reload Gnome-Shell and the changes will come into effect.
If you login with fallback mode, you may still find the icons showing at left.

$ sudo apt-get install gconf-editor

Press Alt+F2 to bring up the Run Application dialog box, enter “gconf-editor”

The key that we want to edit is in apps/metacity/general

Change the text in the button_layout key Value text field to:

menu:maximize,minimize,close

Phew, We are done.