Postingan

Menampilkan postingan dengan label linux

How to close telnet terminal in Linux and Windows (quit, exit not working)

Gambar
The telnet is one of the most useful Linux networking commands, which is used to check if a server is listening on a particular port and it's whether up and running or not, but it's a little bit tricky to use, especially, if you are not using it on daily basis. Though I have used telnet before, when I use it after a long time, I actually forgot how to close the telnet terminal and how to get out of it. I tried every possible  Linux commands I can think of which is used to close, cancel a command, or exit from VIM editor in UNIX, like Ctrl + C , quit , exit, q! and even the escape character '^]' , only to realize that nothing is working. It may sound silly that an experienced developer cannot even come out of a telnet terminal but this is a true story. What I have noticed in general that, even though we learn new things when our experience grows, we actually forget something equally important as well, particularly if you don't use that thing or command on daily bas...

Linux Command to Find how Long a process is Running in UNIX

Gambar
Hello guys, today, I am going to share one of the useful tips to find out how long a particular process is running in Linux. This is very useful while you are troubleshooting an issue and want to know whether your process or service is restarted fine on a daily or weekly basis. So you checked your process is running in Linux operating system and it's running fine, by using ps command. But now you want to know, from how long process is running , what is the start date of that process etc. Unfortunately, PS command in Linux or any UNIX based operating system doesn't provide that information. But as said, UNIX or Linux has commands for almost everything and if there is no command, you can also check some important files in the /etc directory to find out some useful info. It’s been a long time, I have posted any UNIX or Linux command tutorial, after sharing some UNIX productivity tips. Hence, I am going to share this nice little tip, which you can use to check how long a particular...

How to find and kill a Process Listening on a port in Linux? netstat and lsof command examples

Gambar
In Linux, many times, you want to find out the PID of a process which is listening on a port e.g. if multiple tomcat servers are running on a host and you have to kill that process, but in order to kill that process you need the process id, how do you find the PID of the tomcat listening on port 8080? There are many Linux commands to find the process using a specific port, but I'll share what I use. I always use the netstat command with -p option , which displays process id of the process listening on a port. Btw, netstat is not the only command to find all processes using a particular port , you can also use the lsof command for the same purpose. If you remember, we have used lsof earlier to find all the processes accessing a file but it can also be used to find all processes accessing a specific port. You will see the example of both netstat and lsof commands in this article to find the PID of process listening on a specific port in Linux. On the related note, it's very impo...

10 Example of find command in UNIX and Linux

Gambar
The find command is one of the most versatile commands in UNIX and Linux, and I used it a lot in my day to day work. I believe having a good knowledge of find command in UNIX and understanding of its different options and usage will increase your productivity a lot in UNIX based operating system, e.g. Redhat Linux or Solaris. If you are a QA, support personnel, and your works involve lots of searching text on Linux machine or if you are a Java or C++ programmer and your code resides in UNIX, find command can significantly help you to look for any word inside your source file in the absence of an IDE. It is the alternative way of searching for things in UNIX; grep is another Linux command which provides similar functionality like find but in my opinion, later is much more potent than grep in UNIX. Like any other command strength to find lies in its various options , which is worth learning, but, to be frank, hard to remember. If you can be even able to remember all the options men...

10 Tips Improve Your Speed in Bash, and Linux Command Line

Gambar
Have you ever amazed to see someone working very fast in UNIX, firing commands, and doing things quickly? Yes, I have noticed that a couple of times, and I have always inspired to learn from those superstar developers. In this article or tutorial or whatever you call it, I have dedicated to sharing some UNIX command practices I follow to work fast, quick, or efficiently in Linux. I work for the Financial services industry, and my work involves the development and support of online stock and futures trading applications in Electronic trading, Derivatives, etc. All our services run on Linux servers, so I need to work efficiently and quickly in the Linux machine, and that's how I have learned these productivity tips in Linux. This article is in continuation of my earlier article Top 10 basic networking Commands in Unix and How does nslookup command work in Linux. If you have not read those, you can see if you find them interesting and useful. In this UNIX command tutorial, I am going ...

find + du + sort + head command example in Linux - Ho to search large files and directories in host to free some disk space

Gambar
Hello guys, 100% full disk space is a common problem and as a programmer or Linux user, you often need to free disk space by deleting biggest files and directories. In order to do that, you need to know some Linux find command examples to list and delete some biggest files and directories and that's what you will learn in this tutorial. As a Java developer, you also need to also support your application, most of which mostly run on Linux machines. Though production is monitored by the dedicated support teams and they receive regular alerts on the status of file system space, they often come running to you or the developer responsible about what to do when disk space is almost full or reaching 100%. This is even more common on UAT and QA/TEST environment where no one really monitors and then people start coming screaming to you that things are not working, Java processes are not up and systems are not able to connect to each other, only to find that there is no space left in the mac...

10 Example of lsof commands in Linux and UNIX

Gambar
It's been a long time since I have written anything on UNIX or Linux commands. Still, today, I'll talk about the lsof command , a utility command every system admin and developers love. The lsof command stands for list open file descriptors, and as the name suggests, it is used to find open files by the 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 special block file, an NFS mounted file, a socket stream, a shared library, a special character file, a regular pipe, a named pipe, an internet socket, a UNIX domain socket, and many others. I have mostly used it to find all the files opened by a particular process, which I will show you in the next section. It's an incredibly useful tool to do debugging and troubleshooting in UNIX and Linux environments. Because of its versatile nature, it's also known as the " The Swiss Army Knife of Linux." Since most of the production s...

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

Gambar
I have been sharing programming books in this blog for a long time, starting with core Java; I moved to other related technology, likeSpring, 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 the UNIX operating system. Most of the books on this list are timeless,  classic, and don't age with time, much like UNIX, which is around for the last 40 years, and I am sure it will be around for the next 40 years, or maybe forever. If you don't know, I love books, both reading and collecting. I have a strong passion for finding high-quality publications and already having 100s of titles in my bookshelf. I am reading books from my childhood when I started reading pocketbooks, comics, magazines, storybooks, and then slowly moved on to Physics,...

How to send HTTP request using curl and wget command from Linux and UNIX? Example Tutorial

Gambar
You can use either curl or wget command to send HTTP requests from UNIX or Linux operating system. Both commands allow you to send GET and POST requests, which means you can also call REST web services.  I have a Java web application, which runs on Linux and exposes WebServices. I was writing a UNIX script to download In some data from that web service when I hit by the question, how do I make an HTTP call from UNIX? What is the UNIX command should I use? If you are also facing the same problem, then you have come to the right ht place. Basically, you can use two UNIX commands to make the HTTP request, wget, and curl. You can use curl and wget to send both GET and POST HTTP requests. My use case was rather simple, I just need to make a GET call to web service to download the data, but these two commands are mighty and provide many different options to interact with the web using HTTP right from the shell. Between wget and curl (also known as cURL), curl (I call it "karl") ...

Top 5 Courses to Learn Shell scripting in Linux (bash, ksh, csh) Online - Best of Lot

Gambar
Hello guys, you might know that a massive chunk of a developer's time is wasted in trying to repeat tasks and commands, especially when it comes to working with a bunch of UNIX or Linux machines, and a good knowledge of shell scripting can free you from such mundane task and give time to do some interesting stuff. If you don't know what shell scripting is then let me tell you is nothing but a program written using shell built-ins, and Linux commands to automate things, like checking if a host is reachable or finding and deleting large files which are older than certain days or archiving them into another machine. Basically, it's a tool that allows you to automate the boring and repeating task, and that's the way programmers should work. They should not be repeating stuff; instead, they should be investing that time to create a script or program which can automate that task. Why Learn Shell scripting like Bash in Linux? I always ask programmers, developers, and system ad...