Archive for category linux
Sort according to the nth Column in Shell Script
Posted by Srijith R in linux, shell scripting on June 21, 2010
You have a file that has multiple columns separated by a specific delimiter and you need to sort it according to a specific column which need not be the 1st column. If its not the 1st column then ordinary sort wont work. So we need to use the parameters of sort to specify the exact column so that it will sort according to that column only. There are parameters in sort like -t and -k, we use this for the sorting. So -t is to specify the delimiter and -k to specify the column needed. For example : We need to get the 3rd column of a csv file(csv file has , as delimiter) the option should be -t, -k3. We can use two more options for the same. -n for sorting the values as numbers instead of considering as text and -r for sorting in descending order ie biggest value on the top. So the final command is :
Continue reading “Sort according to the nth Column in Shell Script” »
Adding RedHat DVD as Repository
When we try out a new linux OS its always a pain to download and install all the software and add packages we needs on that. Its even worse if you don’t have an unlimited connection. But actually most of the software we need is already there in the CD/DVD in which the operating system comes with. So how do we install from the DVD then rather than from the internet?
For this you need to add the DVD as a repository so that rpm client picks up the rpm from the DVD and wont go to internet for it.
The Procedure and Files to be modified is a bit different for each OS so i will cover Red Hat Linux in this post.
In RHEL the repo list is maintained in the folder /etc/yum.repos.d/ . So lets create a new file in this directory , say lets call it rhel-cd.repo.
The Contents of this file should be as follows:
Continue reading “Adding RedHat DVD as Repository” »
Change Timezone in Linux from command line
Changing the timezone in linux is done in a weird method. There is no configuration file where you can edit and change timezone. The method is simple and very easy. You need to link to the timezone you need. Find the timezone file you need in /usr/share/zoneinfo/. Go to correct folder and find the place nearest to you( or with the correct timezone). Now link it to the /etc/localtime with the following command example
Continue reading “Change Timezone in Linux from command line” »
How to Save file in vi not opened with sudo
Posted by Srijith R in linux, shell scripting, vi on December 26, 2009
It has happened to me a lot of times that i edit a file in vi. I insert and edit a lot and finally when I try to save it I find that I dont have permission for it. If only I had opened it with sudo. I found a solution for this issue. It was actually a simple command and here it is
Continue reading “How to Save file in vi not opened with sudo” »
Script for Auto Copying of Cds/Dvds
Posted by Srijith R in linux, shell scripting on December 26, 2009
Here is a script that i created for automatically copying all the files in cd to a folder and ejecting and waiting for the next cd.
So here is how it works.
You need to change the folder names and paths accordingly. And the shell script as
Continue reading “Script for Auto Copying of Cds/Dvds” »
Microsoft Servers in Linux
Well this is funny Microsoft has it’s ” download.microsoft.com” servers running in linux. Good going guys. You people know what’s the best suited ones. But do you know a product of yours called Windows Server edition?
Continue reading “Microsoft Servers in Linux” »
Copy in Linux with Ui
Posted by Srijith R in linux, shell scripting on December 13, 2009
The program here is an UI for cp command. I have used cp in the background but over that I am just monitoring the files copied and speed of copying.
It’s not a perfected program. It’s quick one but works fine.
Execution:
Create a file named copy and insert the following code and give execute permission
Continue reading “Copy in Linux with Ui” »
How to Format a Usb in Linux
There are two methods of formatting a usb in linux that I use.
- The first method is using gparted (or parted non gui version of gparted). This is an easy gui interface that uses shell commands as backend. It is easy to do it.
You install this package using the command. Continue reading “How to Format a Usb in Linux” »
Recent Comments