You are not logged in.

#1 2012-12-20 00:25:06

Archenduser
Member
Registered: 2011-08-12
Posts: 29

List current directory contents in lxterminal

What files would I need to edit in order to make every "cd" command automatically execute "ls -a" when using lxterminal? So if i moved from root  to my home folder it would automatically list all files found in that folder.

Offline

#2 2012-12-20 00:28:43

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

Re: List current directory contents in lxterminal

You would edit your ~/.bashrc file and make an alias something like:

alias cd='cd $1 && ls -a'

(but I'm not sure about the $1 part - try it out)


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

#3 2012-12-20 01:25:48

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: List current directory contents in lxterminal

You need a function - you can't pass variables to aliases.

Offline

#4 2012-12-20 05:55:47

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

Re: List current directory contents in lxterminal

Absolutely right there tomk. Doh!

Something like this:

cdls(){
    cd $1
    ls -a
}


might work?


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

Board footer

Powered by FluxBB