This is a tutorial about some important Linux commands for developers. Every Linux distribution like Ubuntu, Fedora, RedHat, CentOs etc. comes with shell commands. Knowing some of important Linux commands is a beneficial for a developers who program for Linux based application. So let us discuss some of them.

Some important Linux commands for developers

  • file command

  • pwd command

pwd command is known as present working directory. pwd command print full path of working directory.

  • ls command

  • pkg-config linux utility command

pkg-config is linux utility or tool which read meta data stored in .pc files. Suppose you are going to write simple application using gtk library.gtk is GUI toolkit used by gnome linux desktop. if you don’t know the exact name of library you can list down by executing pkg-config –list-all.

save this code in file win.c, and compile it by below command
gcc -o win win.c pkg-config --libs --cflags gtk+-2.0

The command pkg-config --cflags will give header information while pkg-config --libs gives library linker flags

  •  find command in Unix/Linux

find command is powerful utility of Linux/Unix. It is used to search a file in a directory hierarchy. Let us assume we have terminal window like below

Some important Linux commands for developers

Look at the above sample terminal window. The current working directory is “myproject“. we have run command “find -iname main.c“. Here find commands prints full path of file main.c in all the child directory. Find also searches file in current directory. -iname is switch which directs the find command to search file main.c with case insensitive.

  • grep command

In linux based system grep command is most important command. grep is used to find a string in a file. The full name of grep command is global search for regular expression and print. following sample command will search “stdio” in all the files from working directory and if a file contains string “stdio”, the full path of file would be printed with line number.

bosch@bosch-Inspiron-N5050:~/myproject/sample$ grep -inr stdio .

The . means current working directory.

Related Contents to follow