Posts

Showing posts with the label unix

Top 10 UNIX and Linux System Programming Books- Best of Lot, Must Read

I have been sharing programming books in this blog from a long time, starting with core Java , I moved to other related technology e.g. Spring , Design patterns , Data Structure and Algorithms etc. Today, I am going to share some of the best UNIX and Linux programming books . The list contains some of the must read UNIX books from great writers like Sir Richard. Stevens, Sir Brain Kernighan, who has contributed so much to the development of UNIX operating system. Most of the books in this list are timeless, classics and don't age with time, much like UNIX, which is around from last 40 years and I am sure will be around for next 40 years, or maybe forever. Read more �

How to Remove CTRL-M characters From a File in UNIX and Linux

I wanted to transfer some files from Windows to Unix using FileZilla, but the problem arises when these files are transferred (Ascii or Binary mode both) and opened using VI we get ^M characters, also known as CTRL-M characters. I searched about this but the solutions were to remove these ^M characters when files are transferred using utilities. Is there any way that these ^M characters do not appear in the first place? Well, my search continues but I will share the solution which worked for me for removing control M characters i.e. CTRL-M or ^M characters. There are several UNIX commands e.g. dos2unix which can be used to convert a Windows or DOS generated files to UNIX one. You can also use sed command (stream editor) to remove CTRL-M characters without opening the file, very useful if you are removing CTRL-M characters from a large file. Alternatively, you can use VI command to open the file and replace ^M characters with nothing. Read more �

10 Example of lsof commands in UNIX and Linux

Image
The  lsof  command stands for list open file descriptors and as the name suggest, it is used to find open files by process. Since almost  everything in UNIX are file,  you can use  lsof  command to find an open regular file, a directory, a symbolic link, a block special file, a NFS mounted file, a socket stream, a shared library, a character special file, a regular pipe, a named pipe, an internet socket, a UNIX domain socket and many others. It's an incredibly useful tool to do debugging and troubleshooting in UNIX and Linux environment. Since most of the production system runs on the UNIX-based operating system, knowledge of this tool become even more important. As a Java developer, I often use  lsof command  to find all the files opened my Java process, or some time to find which process has opened a particular file e.g. a file which is used to represent a cache in memory, lsof is incredibly useful on doing that. In this tutorial, we are going...

Top 10 basic networking commands in linux/unix

Networking is an essential part Unix and it offer lots of tools and command to diagnose any networking problem. When I was working on FIX Protocol we get a lot of support queries to see whether FIX Sessions are connected or not. Since FIX Protocol uses sockets you can use the netstat , telnet and other networking commands available in Linux for finding a problem and solve that.In this article, I will show you basic networking commands in Unix and for what purpose they are used. with the combination of grep and find command on them, you can troubleshoot most of the networking problem. Read more �

How to delete empty files directories in Unix Linux Server

Deleting empty file and directory in Unix Many times we need to find and delete empty files or directories in UNIX/Linux. Since there is no single command in Unix/Linux which allows you to remove empty files or empty directories rather we need to rely on find command and xargs command . In this UNIX and linux example we will see How to delete empty files and directories. Before removing empty files and directories we need to find those files and there are lots of option available to search for empty directories like find , grep , awk etc. You just need to know correct option. Like in any other operating system empty files and directories in Unix are those whose size is zero. Empty files doesn't contains any content while empty directories does not contain anything at all e.g files or sub-directories. As discussed in previous post 10 frequently used find command examples we can also use find command to search and delete empty files and directories as it provides searching files b...

10 xargs command example in Linux - Unix tutorial

xargs command in unix or Linux is a powerful command used in conjunction with find and grep command in UNIX to divide a big list of arguments into small list received from standard input. find and grep command produce long list of file names and we often want to either remove them or do some operation on them but many unix operating system doesn't accept such a long list of argument. UNIX xargs command divide that list into sub-list with acceptable length and made it work. T his Unix tutorial is in continuation of my earlier post on Unix like 10 examples of chmod command in Unix and How to update soft link in Linux . If you haven�t read those unit tutorial than check them out. By the way In this tutorial we will see different example of unix xargs command to learn how to use xargs command with find and grep and other unix command and make most of it. Though what you can do with xargs in unix can also be done by using options provided in find but believe xargs is much e...