aptosid.com

User Scripts & Dragons - terminal tricks

se7en - 08.10.2010, 07:28
Post subject: terminal tricks
Fast and easy navigating between folder.

I love to use the cli and I never really got used to mc. But moving between folder/with/many/subfolder/ can be a bit time consuming. Here are two commands that might help you to do things faster.

1. 'command !$' which uses the path from your last command
2. 'cd -' which lets you jump between two folder

#create a folder with subfolder

      Code:
se7en@toshibox:~$ mkdir -p easy/to/navigate/
mkdir: created directory `easy'
mkdir: created directory `easy/to'
mkdir: created directory `easy/to/navigate/'


# move to the directory with 'cd !$' ('any_command !$' is possible)

      Code:
se7en@toshibox:~$ cd !$   #instead of cd easy/to/navigate/
cd easy/to/navigate/
se7en@toshibox:~/easy/to/navigate$


#now change to another directory

      Code:
se7en@toshibox:~/easy/to/navigate$cd /media/disk1part4/
se7en@toshibox:/media/disk1part4$


#use the 'cd -' command to fast switch between the two directories

      Code:
se7en@toshibox:/media/disk1part4$ cd -   #instead of cd /home/se7en/easy/to/navigate/
/home/se7en/easy/to/navigate


#and move back

      Code:
se7en@toshibox:~/easy/to/navigate$ cd -   #instead of cd /media/disk1part4
/media/disk1part4
se7en@toshibox:/media/disk1part4$

Sprinter1 - 08.10.2010, 07:45
Post subject: RE: terminal tricks
that's cool! Thx

Sprinter
muchan - 08.10.2010, 08:55
Post subject: RE: terminal tricks
      Quote:

I love to use the cli and I never really got used to mc. But moving between folder/with/many/subfolder/ can be a bit time consuming.


I'd suggest you trying zsh for command shell for a while.
It has strong set of cd comamnds. Search web about zsh and read some
to get the feel about zsh. (I use both zsh and bash, case by case)
se7en - 08.10.2010, 09:14
Post subject:
I did never use zsh because I work on many different Linux systems and bash is always installed.
But thanks I will have a look into zsh.

I was hoping other people have some other tricks to post here.
DonKult - 08.10.2010, 09:32
Post subject:
You might want to have a look at the bash-builtins pushd and popd ( use 'help' command, they have no manpages!).

xd can be interesting, too.
All times are GMT - 12 Hours
Powered by PNphpBB2 © 2003-2010 The Zafenio Group
Credits