Questions tagged [working-directory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
119 votes
7 answers
48k views

Change ConEmu's default start directory

How do I change ConEmu settings such that always when I open it, it will start the cmd in a directory of my choosing instead of the default ConEmu folder?
Nick Ginanto's user avatar
  • 1,405
29 votes
6 answers
30k views

Temporarily change directory for single batch-file command

In shell-scripting if I need to run a command from a directory I can us a subshell to ensure I return to the original context: (cd temporary/new/directory ; command) # now I am still in original ...
Greg's user avatar
  • 965
15 votes
1 answer
10k views

Start bash shell (cygwin) with correct path without changing directory

I need to run a cygwin shell script without changing the working directory, from outside the cygwin environment. If I run just \path\to\bash.exe -c command, then the path is not set correctly and ...
Ben Voigt's user avatar
  • 7,256
9 votes
3 answers
15k views

Run "cd" command as superuser in Linux

Is there a way to run the cd command with superuser privileges to gain access to directories that are owned by root? When I run sudo cd <path>, I get sudo: cd: command not found.
thecomputerguru's user avatar
9 votes
2 answers
38k views

git: get current working dir

How I can get current working dir from console using git? something like: if I'm in: ~/projects/someproject/somesubfolder/, the console command should say /home/va1en0k/someproject/ (if there is a ....
valya's user avatar
  • 908
9 votes
3 answers
4k views

Xargs: change working directory to file path before executing?

I have a large folder of RAR archives. There is a significant hierarchy of folder levels. I want to unRAR the entire collection of archives all at once. I have the following one-liner, which will ...
fdmillion's user avatar
  • 1,391
6 votes
2 answers
5k views

How to check if the current batch file is in a specific folder?

Hi I'm fairly new to batch files, so sorry if this question seems stupid but I really need some help. So I need my batch script to check if it is in a specified folder, say %userprofile%\Desktop for ...
Mantis Tsai's user avatar
4 votes
1 answer
141 views

Ideal Location For Google Identity Toolkit *.p12 file

I'm working on the Google Identity Toolkit, and have come across what appears to be a riddle. "Put the *.p12 file you just downloaded in a directory of your choosing which is private (you can't let ...
user avatar
4 votes
3 answers
2k views

How to get tty shell working directory?

Is it possible to get working directory of any of my tty shells? So\ get working directory of any shell in /dev/ttys??? belonging to me. I use OS X.
tig's user avatar
  • 4,734
3 votes
3 answers
3k views

Using screenrc, how can I make `C-a c` open a new window at the current window's working directory?

Using screenrc, how can I make C-a c open a new window at the current window's working directory? By default it appears to open the new window at the working directory at the time the original screen ...
Matt Joiner's user avatar
  • 1,074
2 votes
5 answers
2k views

Changing working directory of parent script from 'sourced' script

I want to change working directory of my script by another script that has been included. First script: #!/bin/bash pwd source script2 pwd Sedond script: cd .. pwd The result is following: > ...
Sebi's user avatar
  • 146
2 votes
1 answer
11k views

How to open a new terminal tab in Mac OS X with working directory same as the current terminal tab [duplicate]

Possible Duplicate: OS X Terminal.app: how to start a new tab in the same directory as the current tab? This is the default behavior in Ubuntu: when you open an new tab in a terminal, the working ...
user avatar
1 vote
1 answer
2k views

How to count the number of times a file/directory has been opened?

I'm trying to find the number of times a file has been opened (since the OS inception). I'm thinking of doing this via stat, but most flags only return the difference between the LAST time it was ...
mynameis's user avatar
1 vote
1 answer
151 views

popd for cdr-based directory management in zsh

I recently started using cdr in zsh for remembering recent directories. I used to use pushd and the like. One thing I miss is popd, which basically means "I'm done using this directory, put me ...
Ken Williams's user avatar
1 vote
1 answer
1k views

Linux tar: only --transform certain files

I'm writing a bash script that packages my application into a TAR file. The files aren't arranged on disk how they need to be arranged in the TAR file, so I decided to use the --transform option. ...
Bradley Odell's user avatar
0 votes
2 answers
5k views

Setting CMD CD to the directory that the batch was run in

I'm trying to create a batch script that will open a program in a different environment (so I can make a portable version of it). I use this set APPDATA=%CD%\data to tell it to do that. The problem ...
Freesnöw's user avatar
  • 976
0 votes
1 answer
517 views

How would you count every occurrence of a term in all files in the current directory?

How would you count every occurrence of a term in all files in the current directory? - and subdirectories(?) I've read that to do this you would use grep; what is the exact command? Also, is it ...
TellMeWhy's user avatar
  • 111
0 votes
2 answers
44 views

Management of directories and subrutines

From the current directory %CD%, I need to go inside a subfolder and execute a subrutineA, then go back to the %CD% directory and go to the next subfolder and execute the same subrutineA, this process ...
frantika's user avatar
0 votes
0 answers
144 views

What's the equivalent in powershell of `pushd +0`, or `pushd` with no arguments, in linux shells

Good luck searching for +0 :) I did search this forum and stackoverflow for about 30 minutes and didn't find the answer. Linux has the following command: pushd +0 or just pushd with no arguments. ...
john v kumpf's user avatar
0 votes
4 answers
2k views

Open ranger File-Manager in specific Directory

I use ranger as my file-manager and was looking for an option that i can pass to ranger, that let‘s me open ranger in a given directory, something like ranger —specfic-directory=„/home/tim/literature/„...
Tim Hilt's user avatar
  • 237
0 votes
1 answer
1k views

How can I cd to a long path in DOS 6.22?

I have a legacy PC which I have installed DOS 6.22 onto. I'm not sure what specific version this is, but it had CD drivers included, so I'm suspecting it wasn't exactly "bare bones". I created a CD ...
Bartek Banachewicz's user avatar
0 votes
0 answers
32 views

Set CMD Prompt to always be the current directory name in Windows XP? [duplicate]

I would like my command prompt to display just the directory name I am currently in, not the full path. If I am working in C:\Mystuff\Junk\ I would like the command prompt to display: Junk> If I ...
kerbaled's user avatar
0 votes
0 answers
617 views

Getting a setting, the chdir value, out of GNU Screen

I've been using screen's chdir command to set a new working directory for new screen windows, more on that later. What I need to do is find out what the setting was before I set it, so that I can set ...
dlamblin's user avatar
  • 10.7k