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

Asked by Juan Montoya

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:
Last query:
Last reply:
Revision history for this message
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

Revision history for this message
Juan Montoya (th3pr0ph3t) said :
#2

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

Revision history for this message
Juan Montoya (th3pr0ph3t) said :
#3

Thanks KE1HA, that solved my question.