Questions tagged [pwd]

`pwd` is a shell command for "print working directory". When issued, it prints the path of the current working directory.

149 questions
12
votes
2 answers

How to copy to the clipboard the current path?

How can I copy the current path in the bash terminal, using just one command?
tirenweb
  • 30,963
  • 73
  • 183
  • 303
10
votes
4 answers

Replacement for `pwd` in Windows PowerShell

I have a Unix script which uses the command Current_Dir=`pwd` What would be the suitable replacement for it in Windows Power shell script?
user2879237
  • 103
  • 1
  • 1
  • 5
9
votes
2 answers

Collapse directories in zsh prompt in a unique way

Is there a way to collapse the current working directory in the zsh prompt in a unique way, so that I could copy and paste it to another terminal, hit TAB and get the original path? Let's say we have following…
eumiro
  • 207,213
  • 34
  • 299
  • 261
8
votes
2 answers

How to get part of path using linux commands

Need get part of path, for example "/home/server/folder1/rev.1111/bin" Needed part is "rev.1111" I`ll try to parse by PWD & grep commands, but I am newbie on linux and I cant do this.
Roman
  • 1,163
  • 3
  • 9
  • 5
8
votes
3 answers

Python27(win): import daemon, but there is an error: No module named pwd

1) pip install daemon. 2) Open windows cmd and input: python, then input: import daemon the terminal show >>> import daemon Traceback (most recent call last): File "", line 1, in File…
Sinbad lo
  • 85
  • 1
  • 1
  • 6
8
votes
2 answers

"ImportError: No module named pwd" but it exists

I'm trying to test gae-boilerplate locally, but when I try to create a new account the following error appears. The strange thing is that if I open python interpreter and type "import pwd" it works. Internal Server Error The server has either erred…
Moisés Guimarães
  • 116
  • 1
  • 1
  • 6
7
votes
2 answers

Docker Compose says $PWD variable not set Windows

I am new to docker. I currently have docker-compose.yml where volume I want to mount my current directory to '/usr/share/data' in the container. So something like: volumes: - ${PWD}/data:/usr/share/data/ I am using windows with a Linux…
A.Hamza
  • 219
  • 1
  • 4
  • 13
7
votes
3 answers

What's the difference between unix built-in `pwd` command and it's $PWD environment variable?

Here's the case. I have a directory call :- %/home/myname/ I did a soft link in that directory:- %cd /home/myname/ %ln -s /home/others/ . Now, I cd into others/ from /home/myname/ Here's the interesting part. When I did a unix built-in pwd command,…
lionel319
  • 1,180
  • 2
  • 17
  • 31
7
votes
2 answers

How to shadow python builtin pwd module

There is some python code that works under Linux. It uses the pwd module in a way like that: import pwd ... def func(): user=pwd.getpwnam(user)[2] Now we have a specific need to cover this code with tests, and tests have to be runnable…
Dmitriusan
  • 11,525
  • 3
  • 38
  • 38
6
votes
3 answers

Adding directory to PATH through Makefile

I'm having some trouble in exporting the PATH I've modified inside the Makefile into the current Terminal. I'm trying to add to the PATH, the bin folder inside wherever the Makefile directory is. Here's the relevant strip of the makefile: PATH :=…
Bruno
  • 61
  • 1
  • 1
  • 2
5
votes
3 answers

How to print ONLY the current directory that I'm currently in

I'm trying to find a way to properly get only the name of the directory that im in currently. If im in a directory called HW04, and pwd prints out home/zachary/HW04, how would i print out only HW04? Or is using pwd in order to get the name to much?…
Zachariah
  • 81
  • 1
  • 6
5
votes
2 answers

What's the difference between "$pwd" and "./"?

As far as I can see using $pwd and using ./ in PowerShell gives the same result. Are they the same or is there a difference?
J. Doe
  • 1,147
  • 1
  • 13
  • 21
5
votes
1 answer

Understanding the Term \\\"$$PWD/\\\" in qmake project file

I found this line in a qmake project file: DEFINES += SRCDIR=\\\"$$PWD/\\\" I know that the PWD-part stands for print working directory and I let give me the value of SRCDIR: std::cout << "SRCDIR :" << SRCDIR << std::end; I also changed the…
goulashsoup
  • 2,639
  • 2
  • 34
  • 60
5
votes
1 answer

Unix executable files not found in $PATH

I have a problem when using Go. Here is my code: package main import ( "fmt" "os/exec" ) func main() { output, err := exec.Command("pwd").Output() fmt.Println(string(output), err) output, err = exec.Command("ls",…
longuid
  • 116
  • 1
  • 6
5
votes
2 answers

Why is iget() hidden in xv6

I'm playing a bit with xv6, a modern implementation of Unix version 6. For my first hack, I wanted to implement the simple getcwd syscall, but I'm a bit lost as to which level of abstraction I should use. Should I use the struct file interface? Or…
NewbiZ
  • 2,395
  • 2
  • 26
  • 40
1
2
3
9 10