6 votes

Topic deleted by author

1 comment

  1. DMBuce
    Link
    Another way to approach this is to use the cd - command to flip between two directories (in Bash at least, not sure about other shells). Not as powerful as a full directory stack, but personally I...

    Another way to approach this is to use the cd - command to flip between two directories (in Bash at least, not sure about other shells). Not as powerful as a full directory stack, but personally I rarely need to quickly jump between three or more directories in a given shell session.

    Maybe that's a quirk of how I use the shell, though. In a directory structure like this:

    [root@server01 ~]# cd /usr/share/tomcat/
    [root@server01 tomcat]# ll
    total 8
    drwxr-xr-x. 2 root   root   4096 Jan 27 13:51 bin
    lrwxrwxrwx. 1 root   tomcat   11 Jan 27 13:51 conf -> /etc/tomcat
    lrwxrwxrwx. 1 root   tomcat   22 Jan 27 13:51 lib -> /usr/share/java/tomcat
    lrwxrwxrwx. 1 root   tomcat   15 Jan 27 13:51 logs -> /var/log/tomcat
    lrwxrwxrwx. 1 root   tomcat   22 Jan 27 13:51 temp -> /var/cache/tomcat/temp
    lrwxrwxrwx. 1 root   tomcat   23 Jan 27 13:51 webapps -> /var/lib/tomcat/webapps
    lrwxrwxrwx. 1 root   tomcat   22 Jan 27 13:51 work -> /var/cache/tomcat/work
    

    I've noticed that a lot of people will do something like e.g. cd webapps; ls; cd ..; cd logs; view catalina.out in order to look at what's in the webapps directory and then look at the logs in catalina.out. There's even one person I know who wouldn't trust the symlinks and does cd /var/lib/tomcat/webapps and cd /var/log/tomcat instead of those cd commands (actually it's more like cd /var; ls; cd lib; ls; cd tomcat; ls; cd webapps and so on).

    Whereas I would just do ls webapps/; view logs/catalina.out , relying on tab completion so that I don't have to type all of those paths out. That way my shell history is less cluttered and if I need to, say, look at the Apache configs on the same server, I can cd /etc/httpd; view conf*/*.conf and then flip back and forth with cd - from there.

    Anyway, sorry for the overly long explanation. Not saying that this way of doing things is superior or anything, there are of course many ways to skin this particular cat. Just presenting an alternative that works well enough for my needs.

    2 votes