search

Loading

Friday, March 23, 2012

Most useful screen shortcuts and commands in linux

Last time we saw about how to use screen and the advantages of screen. But there are more useful screen tips and tricks. Here I'm going to show you my most used screen commands.


As we saw we have created a screen session called 'backup' last time and logged in to that using screen -r backup or screen -x backup. But you need to remember that that is the name of that particular screen session. Inside a screen session we can have multiple screen windows. Not only that we can name each of these windows.

Wednesday, March 14, 2012

How to use screen in mulit user mode in linux?

Linux screen command is one of the most used command in my life. Not only it is very useful but also it is very versatile. Screen is mainly used to run another terminal inside our normal linux terminal.

For example, you are connecting to your remote computer over ssh and want to run a script which will take more than 1 hour to execute. Normal cases there are chances that your remote connection over ssh might get disconnected. If so you need to start the whole process again as once the remote connection get disconnected, the running process will also stops.

Friday, March 9, 2012

How to find the number of occurance of a character or word in a file

Some times we need to find how many times a character or a word has repeated in file. For this we can use vim. Vim is extremely powerful tool and learning some cool tricks in vim will always help you beat the heat.

So for example, i want to find how many times the word linux comes a file which is full words and lines. Imagine if the file has more than 1000 lines finding manually it will be just waste of time if you know the simple command in the vim.


We can use grep -c linux test.txt, but it will only show the number of lines where the word linux comes.
That's why we are using the vim and the below command.

Wednesday, March 7, 2012

Most useful ps commands in linux

One of the most used commands in linux to find about the running processes in linux is ps command and top command. There are many command line arguments that we can give to these commands to extract the exact information that we need. But it is a bit confusing, right? So here we are going to look for the most used command line arguments in the ps command.

1. ps -eflH

Saturday, March 3, 2012

How to hide a file or folder in Linux

This is a basic question that arises in the mind of the most new linux users. This can be easily achieved in linux. Its a matter of just adding a do in front of the file/folder name in linux.

For example, to hide a file called 'linux-tips.txt', we just need to add a dot in front of it. It will be like this.

.linux-tips.txt

You can use the mv command to do it in command line. The above can be done like this:

mv linux-tips.txt .linux-tips.txt

Once we add the dot infront of it, it won't be visible in 'ls' command. You can view the hidden files by using 'ls -a' command.

The same method works for folders also.