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
1
vote
2 answers

pwd alias causing infinite loop in UNIX (bash)

I have an alias, dir, which works fine using $(pwd) to show me the current directory I'm in: alias dir='echo -e ${color1}jarvis: ${color2}you are currently in the ${color3}$(pwd)${color2} directory, sir.${NC}' I would rather this alias be pwd, or…
codenaugh
  • 857
  • 2
  • 12
  • 27
1
vote
2 answers

exporting name of last but one directory

As explained in this question, we can get name of current working directory. But how to get last but one directory name? Scenario: # working directory /etc/usr/abc/xyz.txt printf '%s\n' "${PWD##*/}" #prints abc #i want to print usr printf '%s\n'…
Aparichith
  • 1,452
  • 4
  • 20
  • 40
1
vote
3 answers

Gtk C Application - Set PWD so pictures work

I have a simple Gtk GUI application written in C. I want to be able to render external images within a frame in my main window. The code for this is as follows: GtkWidget myImage; myImage =…
Cloud
  • 18,753
  • 15
  • 79
  • 153
1
vote
1 answer

echo pwd remotely via ssh

I need a remote machine to print the absolute path of a given file hosted on it, so I do: ssh me@remote.host.net "echo '$(pwd)/file.txt'" Too bad this way pwd gets evaluated locally, not remotely. How can I do this?
Ricky Robinson
  • 21,798
  • 42
  • 129
  • 185
1
vote
1 answer

How to find the folder from which a PHP command line script was launched?

Let's say I have the following folder structure on my hard-drive: /some/dir/ . scripts/ myfile.php Then from '/some/dir/', I run the following command: /some/dir/$ php scripts/myfile.php Then, in PHP, how can I find the folder from…
laurent
  • 88,262
  • 77
  • 290
  • 428
1
vote
1 answer

Getting short path for ssh

I'm writing a shell script to be used with ssh/git. I want to get the present directory relative to home, if possible. The goal is to get the shortest path to be used with ssh, that is the path in context of the user. For example, if my working…
Jonathan Allard
  • 18,429
  • 11
  • 54
  • 75
1
vote
3 answers

How to execute shell command get the output and pwd after the command in Python

How can I execute a shell command, can be complicated like normal command in bash command line, get the output of that command and pwd after execution? I used function like this: import subprocess as sub def execv(command, path): p =…
jcubic
  • 61,973
  • 54
  • 229
  • 402
1
vote
3 answers

pwd from bash from python expand symlinks

I have a shell and I use pwd to show in which directory I am. but when I'm in directory that it's a symlink it show the physical directory not the symlink import subprocess as sub def execv(command, path): p = sub.Popen(['/bin/bash', '-c',…
jcubic
  • 61,973
  • 54
  • 229
  • 402
0
votes
1 answer

matlab javaclasspath() not working in mac

Here is the matlab code: javaclasspath(pwd); % set java path to current working directory % call the java function Result = googleTrend.TrendDataExtractor.ExtractData(Email, Password, word, from, till, scale, handlerHttps, handlerHttp); It runs…
Uzair Farooq
  • 917
  • 3
  • 15
  • 25
0
votes
2 answers

how to get the ino from the current folder?

How to get the ino of the current folder you actually are in, with a unix command? or whether a man, that could be of any use could be provided..
Slrs
  • 105
  • 1
  • 3
  • 11
0
votes
1 answer

How to get pwd relative path in bash without first slash

I am writing a small Bash script to do some automatic commands. In particular , i would like to get relative path without first '/' in pwd pwd : Users\hp\OneDrive\Desktop insted of pwd : \Users\hp\OneDrive\Desktop i'm new to bash and dont know…
0
votes
2 answers

How do I display only the current directory name and not the entire path (pwd) shown in fish/tile prompt?

Good morning, please I installed fish (version 3.6.1) with tide (version 5.5.1) on Debian. I configured tide with the following options selected ... Prompt Style (3) Rainbow Prompt Colors (1) True color Show current time? (1) No Prompt…
CAmechi
  • 11
  • 3
0
votes
0 answers

Wrong PWD when splitting window in tmux while in git diff

When running git diff in a tmux window and I split the window, I expect the newly created pane to use the same working directory. Here are my bindings to split the window: unbind % bind | split-window -h -c '#{pane_current_path}' bind - split-window…
Jan
  • 13
  • 3
0
votes
1 answer

Run bash script in current directory Linux

Why can't I run a bash script in the current directory I'm in? Whenever I run the script the commands are executed in the home directory. The only answers I found are included below. I do use the zsh shell. I don't know if that changes…
Janek
  • 3
  • 1
  • 1
0
votes
0 answers

execute shell commands within contents of node package

I am building a typescript/node.js based package that has two directories called folderOne and folderTwo. folderOne has a file called folderOneFile.ts. When the package is run as a tool installed from yarn, code from folderOne.ts is run as…
Sabo Boz
  • 1,683
  • 4
  • 13
  • 29