How can I echo the current directory on linux command line?

Asked by Juan Montoya on 2010-08-12

Hi,

In Windows, the command was 'cd' without arguments.
In linux, cd prints nothing, and 'dirname' only prints '.'.
I wonder what is the comand that prints the absolute path of '.'.
Right now I'm using a tiny python script that goes like this:
import os
print( os.path.abspath(os.curdir) )

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Solved by:
Greg Beam
Solved:
2010-08-12
Last query:
2010-08-12
Last reply:
2010-08-12
Best Greg Beam (ki7mt) said : #1

Hi Th3Pr0ph3t,

Short answer - Echo Abs Directory = pwd

ls = dir in Dos/Win
mv = cp in Dos/Win
rm = del in Dos/Win
pwd = dir in Dos/Win
cd = cd in Dos, its just uses differently, e.g. [ cd /user/home ] takes you to your home directory, so does [ cd ~ ] the difference in Dos/Win is the they are back-slash \\ where as in Linux they are all forward-slash //

He's a list that shows their equal partners: http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html

KE1HA

Juan Montoya (th3pr0ph3t) said : #2

Thanks!
(I used to think pwd was password or something)

Juan Montoya (th3pr0ph3t) said : #3

Thanks KE1HA, that solved my question.