Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, 13 August 2013

Deleting Public Keys from GPG and RPM key rings



In order to delete the public keys from the key ring, we would require the key_id. The key_id can be idenfied using the below steps using the file where the public key is stored.

To get the Key Details

gpg --throw-keyids < [Key-File-Absolute Path]

pub  1021D/1689B887 2005-03-11 ABC Company 
sub  1048f/47E5X96D 2005-03-11  [expires: 2015-03-09]

To get the Key-ID from the keyfile

key_id=${gpg --throw-keyids < [Key-File-Absolute Path] | head -1 |  awk {'print $2'} |  cut -d '/' -f2 |  tr [A-Z] [a-z]}

1689B887

Delete from GPG keyring

gpg --delete-key  --yes $key_id

Delete from RPM keyring

rpm -e --allmatches gpg-pubkey-$key_id

Wednesday, 17 July 2013

Linux script to display tree structure of directory

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'


Output from  a folder. This displays "ONLY" directories
 .
   |-resources
   |-src
   |---java
   |-target


(or)


yum install tree

tree -A
.
├── resources
├── src
│   ├── Hello.java
│   └── java
└── target

-A to be used if you use garbage chars as follows

.
âââ resources
âââ src
â   âââ Hello.java
â   âââ java
âââ target



Reference
http://ssteiner.wordpress.com/2009/05/12/quick-linux-tree-view-of-directory-contents/



Tuesday, 20 November 2012

Change Timezone in linux

Changing timezone in linux can be done using the below steps. Timezone is set using a symbolic link at /etc/localtime.


1. Check Date
     [root@vidhya-dev-vm1 ~]# date
     Tue Nov 20 14:23:51 IST 2012


2. To see how the current localtime is set
     [root@vidhya-dev-vm1 ~]# ll /etc/localtime


     lrwxrwxrwx. 1 root root 39 Nov 20 11:47 /etc/localtime -> /usr/share/zoneinfo/right/Asia/Calcutta

3. Check all the timezones
     [root@vidhya-dev-vm1 ~]# ls /usr/share/zoneinfo/
     Africa      Brazil   Egypt    GB         Hongkong     Jamaica    MST      Portugal    ROK        WET
     America     Canada   Eire     GB-Eire    HST          Japan      MST7MDT  posix       Singapore  W-SU
     Antarctica  CET      EST      GMT        Iceland      Kwajalein  Navajo   posixrules  Turkey     zone.tab
     Arctic      Chile    EST5EDT  GMT0       Indian       Libya      NZ       PRC         UCT        Zulu
     Asia        CST6CDT  Etc      GMT-0      Iran         MET        NZ-CHAT  PST8PDT     Universal
     Atlantic    Cuba     Europe   GMT+0      iso3166.tab  Mexico     Pacific  right       US
     Australia   EET      Factory  Greenwich  Israel       Mideast    Poland   ROC         UTC


4. Backup existing timezone and link new timezone
     [root@vidhya-dev-vm1 ~]# mv /etc/localtime /root/localtime_bak
     [root@vidhya-dev-vm1 ~]# ln -sf /usr/share/zoneinfo/America/Denver /etc/localtime
     [root@vidhya-dev-vm1 ~]# date
     Tue Nov 20 01:56:59 MST 2012