Wednesday 15 June 2016

Linux and Unix pwd (Print Working Directory) command


 What is pwd?

pwd‘ stands for ‘Print Working Directory‘. As the name states, command ‘pwd‘ prints the current working directory or simply the directory user is, at present. It prints the current directory name with the complete path starting from root (/). This command is built in shell command and is available on most of the shell – bash, Bourne shell, ksh,zsh, etc.pwd is one of the simplest yet most popular and most widely used command. A good command over pwd is basic to use Linux terminal.

Basic syntax of pwd:

 pwd [OPTION]...

Options used with pwd
-L --logical         If the contents of the environment variable PWD provide an absolute name of the 
                     current directory with no "." or ".." components, then output those contents, 
                     even if they contain symbolic links. Otherwise, fall back to default -P handling.


-P --physical        Print a fully resolved name for the current directory, in which all components of
                     the name are actual directory names, and not symbolic links).

--help               Display a help message, and exit.

--version            Display version information, and exit.

This article aims at providing you a deep insight of Linux command ‘pwd‘.

1. Print your current working directory.

anurag@linuxgosolution:~$ /bin/pwd

/home/anurag

2. Print version of your ‘pwd’ command.

anurag@linuxgosolution:~$ /bin/pwd --version

pwd (GNU coreutils) 8.24
Packaged by Cygwin (8.24-3)
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jim Meyering.

Important: You might have noticed that we are executing the above command as “/bin/pwd” and not “pwd”.


3.
What is the absolute path (starting from /) of the pwd binary file.

/bin/pwd

4. What is the absolute path (starting from /) of the pwd source file.

/usr/include/pwd.h 


Tuesday 14 June 2016

Changing The Time Zone In Linux (Command Line)

There are several different ways to manage time in Linux. This quick tip will show you how to quickly change the local time to the correct time zone for the server. In this Linux tip I’ll show you how to change the localtime to your (or a) current time zone.
Location of the local time file
Linux looks at /etc/localtime to determine the current time of your machine. This can either be a symbolic link to the correct time zone or a direct copy of the time zone file.


Timezone files are located in /usr/share/zoneinfo/
For this tip we will assume your server is located in Asia and will be under the Kolkata  zone.
I change the Linux time zone by copying or making a symbolic link to from /usr/share/zoneinfo/Asia/Kolkata to /etc/localtime
For RHEL 6
1) cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
2) ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
For RHEL 7 & Ubuntu 14.04
1) timedatectl set-timezone Asia/Kolkata
Arun
 

Tuesday 17 May 2016

How to convert .ppk file into .pem file - UBUNTU


If you would like to convert .ppk file into .pem file, the process are given below:
1) Open terminal and make Your login.
2) sudo apt-get install putty-tools.
3) puttygen /var/www/html/abc.ppk -O private-openssh -o /var/www/html/abc.com
4) chmod 400 /var/www/html/abc.prm