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
5
votes
2 answers

How to force an ImportError on development machine? (pwd module)

I'm trying to use a third-party lib (docutils) on Google App Engine and have a problem with this code (in docutils): try: import pwd do stuff except ImportError: do other stuff I want the import to fail, as it will on the actual GAE…
jerd
  • 75
  • 6
5
votes
3 answers

How does linux-kernel read proc/pid file?

How and Where does linux-kernel read proc/pid file which shows all processes in the system. I found linux-source-2.6.31/fs/proc/ Here there are files, but it is hard to understand because it is really complicated. Can someone knows, how it works?
Iguramu
  • 2,080
  • 5
  • 26
  • 30
4
votes
1 answer

How to create relative path from absolute path in bash?

I am in this directory: /home/michal/project/test/my-utils/rel/0.1.0 and I would like to get the relative path to /home/michal/project/ in Linux shell: ../../.. I've tried something with sed but I did not succeeded in creating the regular…
Michal Špondr
  • 1,337
  • 2
  • 21
  • 44
4
votes
3 answers

When Runtime.getRuntime().exec call linux batch file could not find its physical directory

I have an java application.And I use Runtime.getRuntime().exec for call a batch file.When I call a linux batch file using with Runtime.getRuntime().exec the batch file could not find its own directory. I use pwd command in batch file but it returns…
4
votes
2 answers

pwd output after moving current working directory to a new location

I have a general question as to why this occurs, and a misconception about 'pwd'. You start with directory /test and in it you have /test/folder1. Folder 1 has: file1.txt In 2 separate terminals we "cd /test", and do an "ls" and discover folder1 as…
4
votes
4 answers

What is the `pwd` of a Mac bundled app?

I'm running a GLFW app (that I wrote in C++) I run it as follows: ./prog.app/Contents/MacOS/prog # from the command line However, my code can't read relative-pathed files properly. So I believe what's happening is that this Mac Bundle is changing…
anon
  • 41,035
  • 53
  • 197
  • 293
4
votes
2 answers

python, get encrypted user password from shadow

I'm trying to obtain the encrypted system user password in order to compare it with another sha512 encrypted one. I tried pwd, but it seems that this module does not deal with user passwords, or the used system is "too modern" for it (a debian…
ScotchAndSoda
  • 3,811
  • 4
  • 34
  • 38
3
votes
0 answers

What can cause the working directory to be changed (if `Dir.chdir` is not called)?

I have a script that uses Dir.getwd to get the current working directory multiple times. Then it does things with it. This works for 99.9% of the users all of the time but for some users it returns an unexpected value in some cases. This causes an…
janpio
  • 10,645
  • 16
  • 64
  • 107
3
votes
1 answer

Using Bash environment variables from within a Perl script?

I am trying to run a Bash command from within my Perl program. However Perl seems to be confusing my Bash $PWD environment variable as a Perl variable. How can I make it just read it all as a string? This is what I'm trying to run my $path =…
Ryan
  • 948
  • 6
  • 20
3
votes
1 answer

What does cd // means (change directory to //)

I'm still a Linux newbie and I'm wondering: What is the Linux directory // ? I can change dir (cd) to the root dir using cd / ~> cd / /> Using pwd (print name of working directory) tells me I'm in root (/) /> pwd / Using ls (list directory…
Phiplex
  • 139
  • 1
  • 13
3
votes
2 answers

How do I extract partial path from pwd in tcsh?

I want to basically implement an alias (using cd) which takes me to the 5th directory in my pwd. i.e. If my pwd is /hm/foo/bar/dir1/dir2/dir3/dir4/dir5, I want my alias, say cdf to take me to /hm/foo/bar/dir1/dir2 . So basically I am trying to…
Abhinav
  • 33
  • 5
3
votes
3 answers

Path of the current, parents and root directory

I need to print the path of the current, parent and root directory in UNIX. I can use commands, or a shell script. I managed to do that for the current and the parent directory, but I do not know how to print it for the root directory. Here is what…
dd1714
  • 139
  • 1
  • 6
3
votes
3 answers

How to implement your own cd command in your own shell

I am working in a mini project: "MY OWN COMMAND INTERPRETER (SHELL)", like the Bash shell or Sh shell. Till now it can execute every predefined commands like ls, ps, pwd, date. Except this I have implemented some other operations like Input…
Sourabh Das
  • 73
  • 1
  • 2
  • 9
3
votes
1 answer

$PWD in window title bar, both in Bash and Tmux

I want my window title bar to show my PWD. In my .bashrc I have this which seems to do the trick for Bash: # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h:…
Alex Shroyer
  • 3,499
  • 2
  • 28
  • 54
3
votes
3 answers

BASH - commands string-like

I am wondering if it is possible in BASH to use commands in this way: lets take command pwd Lets say I would like to have a variable comm="pwd" and then use it somewhere in program, but when I use it, I get the real pwd command output. Is this even…
user1926550
  • 539
  • 5
  • 10
  • 18
1 2
3
9 10