EMBED YOUR TERMINAL RECORDINGS ONLINE

Directory bookmarks using shopt

DATE: 2015-03-06
AUTHOR: coderofsalvation
AUTHOR WWW: http://leon.vankammen.eu/blog/tech
RELATED ARTICLE: http://www.gnu.org/software/bash/manual/html_node/The-Sho...

Related recordings:

LIST DIRECTORIES IN LINUX WITH LS
tags: ls directory show content linux disk beginner
THE UNIX TREE COMMAND
tags: unix console tree bash directory listing
PUSHD,POPD: DIRECTORY SHORTCUTS
tags: pushd popd dirs long directory shortcuts
CD -
tags: bash
NOTITLE
tags: bash variable search replace
CONDITIONAL CRON USING DATE %A
tags: cron shellscript conditional bash schedule
CUT TEXT FROM CONSOLE OUTPUT
tags: cut manipulate text bash shellscript
AIRCRACK-NG - MODE MONITOR
tags: aircrack-ng monitor mode bash
VIM MAPPINGMANAGER PLUGIN
tags: vim editor text vi bash keyboard shortcut mapping
BASH EVENT DESIGNATOR
tags: bash history events designator trick shortcut

EMBED THIS RECORDING:
<div><script id="playterm-MjAxNS0wMy9jZGFibGV2YXJzdHR5cmVjLTE0MjU2NDE1Nzd8ODB4MjQ=" type="text/javascript" src="http://www.playterm.org/js/?hash=MjAxNS0wMy9jZGFibGV2YXJzdHR5cmVjLTE0MjU2NDE1Nzd8ODB4MjQ=" class="size:80x24"></script></div>
I recorded this `directory bookmarks using shopt` shellsession because 'cd -' is used by most of us
to switch between current/last directory.

Here's a cool technique which allows directory bookmarks.

### ~/.bashrc :

   [[ -f ~/.bashrc.dirs ]] && . ~/.bashrc.dirs

### ~/.bashrc.dirs define:

   export slog="/mnt/disk1/me/projects/solidrake/var/log"

This will allow you to type:

$ cd slog
$ pwd 
/mnt/disk1/me/projects/solidrake/var/log

john c said

actually no need or 'export', just type this:
log=$(pwd)
instead of:
export log="($pwd)"

 

Name   
Email (never shown)  
Comment