Tag Info

New answers tagged


Another, using the bash options set internal variable, $-. From .bashrc, # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac


From man bash under CONDITIONAL EXPRESSIONS: -t fd True if file descriptor fd is open and refers to a terminal. Assuming fd 1 is standard out, if [ -t 1 ]; then should work for you. The Advanced Shell Scripting Guide claims that -t used this way will fail over ssh, and that the test (using stdin, not stdout) should therefore be: if [[ -t 0 || -p ...


Test for the existence of the PS1 environment variable: # If $PS1 is null, not being run from a shell if [ -z $PS1 ] Alternatively you can test for it being not null, i.e., run from the shell if [ -n $PS1 ]


Press Ctrl+C to copy. When you paste into a terminal, what you'll get is the file name (with its full path). You get the raw file name, which won't be directly usable in a shell command if it contains spaces or other special characters. To use the file name in a command, don't use a paste command from the terminal, let the shell do the pasting. Install the ...


Click on it, press Ctrl+C and just paste it. If you use xclip -selection c w for pasting instead of Ctrl+Shift+V you won't get any file:// prefix or URL encoding. I recommend wrapping that into something more convenient to use and using it for manipulating the clipboard when you're in the terminal. Here's an article that discusses this method using the ...


And if you are too lazy to perform all the steps Gilles outlined you could install the following Nautilus script to copy the path of the active directory with a hotkey: #!/bin/bash # Copy current directory to clipboard # Dependencies: xclip echo "$PWD" | xclip -selection c For installation instructions and a tutorial on how to set up a key binding for ...


Press Ctrl+L to focus a widget to edit the current directory, then Ctrl+C to copy the path and Esc to cancel. If you right-click on an item, use the “Copy” menu entry, and paste into a text box, that pastes the path to the file. With Nautilus 3.4.2, you can right-click on an item the button bar at the top that shows the path to the current directory and ...

Top 50 recent answers are included