• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
iGuRu

iGuRu

Real-time Technology News. Opinions & Tweaks

  • / news
  • / tools
  • / tweaks
  • / dummies
  • / opinions
  • / support
  • / yourpost
home / tweaks / CD hack with location history

CD hack with location history

17/09/2020 07:42 by giorgos

I was on a system that did not have this hack, and it reminded me how useful it is. So I thought I would share it with others.

Some of you may know about pushd and popd commands. The pushd is like the cd, but it watches and remembers where you were. You can then display as many levels as you want. It's like a cd but it keeps a history not only for the last time you used it.terminal - CD hack with location history

The big problem I have with pushd and popd is that for popd to work, I have to remember to pushd first.

But, like most, by default, I give commands to the terminal using the cd command. By the time I realize popd could be useful.

Now the hack.

Just pass the following code to ~ /.bashrc:
[pastacode manual=”function%20cd%0D%0A%7B%0D%0A%20%20%20%20if%20%5B%20%24%23%20-eq%200%20%5D%3B%20then%0D%0A%20%20%20%20%20%20%20%20pushd%20~%20%3E%20%2Fdev%2Fnull%0D%0A%20%20%20%20elif%20%5B%20%22%20%241%22%20%3D%20%22%20-%22%20%5D%3B%20then%0D%0A%20%20%20%20%20%20%20%20pushd%20%22%24OLDPWD%22%20%3E%20%2Fdev%2Fnull%0D%0A%20%20%20%20else%0D%0A%20%20%20%20%20%20%20%20pushd%20%22%24%40%22%20%3E%20%2Fdev%2Fnull%0D%0A%20%20%20%20fi%0D%0A%7D” provider=”manual” lang=”php”/] Και ξεκινήστε ένα νέο shell. Από εκείνο το σημείο και μετά, το cd θα τρέχει το pushd και το popd θα είναι πάντα διαθέσιμο όταν το χρειάζεστε.

Do you have a tip or a trick you want to share? If so, write a comment and we will give it as a post for everyone.

CD hack with location history was last modified: 10 November, 2020, 9: 10 pm by giorgos

spread the news

  • Facebook
  • Twitter
  • Reddit
  • Printing
  • Email

Read them Technology News from all over the world, with the validity of iGuRu.gr

Follow us on Google News


Competition: tweaks

You May Also Like

Find the installation date of an application in Windows 10
How to keep the Calculator always on top in Windows 10
How can WordPress run faster?

About Us giorgos

George still wonders what he's doing here ...

Previous Post: « Google vs stalkerware when the company closes its eyes
Next Post: jackdaw: Collection of information for a domain »

Reader Interactions

Comment Policy:

IGuRu.gr does not publish the comments immediately. Malicious comments, comments that include ads, or comments that are offensive are deleted without notice. We do not adopt the opinions expressed by our readers.
Your comments will be displayed after approval by the administrators


Leave your comment
Ακύρωση απάντησης

Your email address is not published. Τα υποχρεωτικά πεδία σημειώνονται με *

 

 © 2021 · iGuRu.gr · ☢ · Keep It Simple Stupid Genesis theme

about  ·   get in touch  ·  rss  ·  sitemap  ·  cough

loading Cancel
Could not post post - check your email address!
Email verification failed, please try again
Your blog can not post posts via email.