Programming

How to avoid full compilation for a small change in header file in C

Sometimes it is very annoying to wait for full compilation when a small and non-invasive change is made in a common header file that is included by many C files. This typically happens due to header file dependency rules. If you are sure that your change doesn’t really affect other C files expect a few, you change the time stamp of the modified header to a date in past. Also you should change the time stamp of affected C files to current. This ensures that no other files compile except the ones for which you changed the time stamp.

Identifying the More >

How to access file or directory names with spaces in bash command line

When you have to deal with files or directories whose names contain space characters, you will have to use a escape character before each space character.

Bash is a shell which facilitates users to run commands. Bash expects a list of word out of which first word is assumed to the command or program to be run and the remaining words are passed as command line arguments to the program.

So if you try to access a file names “My File.txt” as shown below, it will not succeed because as you can see the original file name is passed as two independent More >

How to search in bash command history easily

If is often needed to run a previously executed command. Generally one uses UP and DOWN arrows to navigate through the command history to get the previous command again.

Especially if you have huge list of commands in history and using UP and DOWN arrows is time consuming, then you can search for the command by typing “Ctrl+r“. The bash shows a prompt as shown below when you press Ctrl+r.

[neo@techpulp ~]# (reverse-i-search)`’:

Now you can just type some matching characters and when you are happy with the selected command, just press ENTER key to execute the command. Instead if you want to More >