LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-28-2007, 08:43 AM   #1
dweeb
LQ Newbie
 
Registered: Apr 2004
Posts: 22

Rep: Reputation: 15
PWD command


Hi all,

I was wondering if there was a command or a way to use the pwd command to only display the name of the current directory, and not the full path?

Darren.
 
Old 03-28-2007, 08:55 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,870
Blog Entries: 14

Rep: Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112Reputation: 1112
basename `pwd`
(backticks)

-OR-

pwd |awk -F/ '{print $NF}'
(single quotes)
 
Old 03-28-2007, 09:04 AM   #3
dweeb
LQ Newbie
 
Registered: Apr 2004
Posts: 22

Original Poster
Rep: Reputation: 15
Thanks jlightner, that's perfect!

Darren
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the dirname only from pwd? EmLS Linux - General 3 04-21-2006 01:22 AM
reset pwd to root's current pwd? ataraktos2 Linux - General 10 04-26-2005 04:13 AM
changed pwd tekmorph Linux - Security 5 09-15-2004 09:47 PM
pwd problem naren Programming 1 04-01-2004 04:52 AM
pwd Penguin666 Linux - General 1 11-19-2003 07:54 PM


All times are GMT -5. The time now is 12:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration