Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Directory list shortcuts UNIX
in the terminal, the command "ls" lists the directory contents of the directory you're in.
"ls -l" lists the directory contents in "long" format, allowing you to see each file's/directory's privileges.
"ls -la" lists the COMPLETE directory contents in "long" format, including all . files.

Shortcuts:
simply typing "l" is equivalent to "ls -l"
simply typing "ll" is equivalent to "ls -la"

[Editor: And typing "alias" will show you some other pre-defined shortcuts!]

hope this helps!

jmil
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[3,647 views]  

Directory list shortcuts | 2 comments | Create New Account
Click here to return to the 'Directory list shortcuts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Actually...
Authored by: babbage on May 02, '01 05:46:12PM
"ll" is equivalent to "ls -la"

Actually, it's even better than that -- it's:

"ls -la | more"

That way, it scrolls when you get a page worth of information. Very cool. It
looks like you get other default aliases too:
.       pwd

.. cd ..
cd.. cd ..
cdwd cd `pwd`
cwd echo $cwd
ff find . -name !:1 -print
files find !:1 -type f -print
l ls -lg
line sed -n '!:1 p' !:2
list_all_hostnames grep -v "^#" /etc/hosts
ll ls -lag !* | more
term set noglob; unsetenv TERMCAP; eval `tset -s -I -Q - !*`
word grep !* /usr/share/dict/web2
wordcount [...omitted to fix html encoding... -- c.d.]

These are interesting. I don't understand the purpose of cdwd -- it changes the
directory to the current working directory, which seems like a no-op to me. Must be some
reason that Apple put it there. Any guesses? I also don't get what the line command
does -- trying it just gives me an error about bad arguments. word is cute -- it
searches for an input word (multiple words probably won't work) on the system directory.
Try word word to get the idea. wordcount is very similar to the built-in
wc command. wc, as in "word count", counts the number of bytes, lines,
characters, or words on an input string. However, for some reason, they seem to produce
close but non-equal numbers:

/Users/chris% links -dump http://www.yahoo.com > yahoo

/Users/chris% wc -w yahoo
628 yahoo
/Users/chris% wordcount yahoo
555
/Users/chris%

Not sure which one to trust there, and I'm not quite bored enough to count by hand.

If you want to add more aliases of your own, create a .tcshrc file in your
home directory, and fill it with commands you don't feel like typing out all the time,
like (some sample lines from my login aliases):


# commands for editing & updating your aliases
# note how multiple commands can be joined together with semi-colons
alias pialias 'pico -w ~/.aliases ; source ~/.aliases'
alias vialias 'vi ~/.aliases ; source ~/.aliases'

# commands for date formatting & display
alias now date '+%Y-%m-%d'
alias today date '+%d.%m.%y'
alias hora date '+%H:%M:%S'
alias clok date '+%Y.%m.%d_at_%H:%M:%S'

# an example of embedding one alias inside another
alias diary 'pico ~/diary/`today`'

# shortcuts for frequently typed commands
alias sshh 'ssh -l yourname yourmachine.yourhost.com'
alias tmail 'telnet mail.yourhost.com'
alias mailme 'cat !* | mail yourname@yourhost.com'
# this last one takes whatever input is coming into it -- whether
# a file or the output of a command -- and emails it to yourname

# stupid `ls` tricks
alias ls 'ls -l !*' # enforce long listings by default
alias dir 'ls -laF !* | more' # DOS style formatting
alias cddir 'cd !* ; dir' # change to, then list directory
alias lsdirs 'ls !* | grep ^d' # very useful! lists directories
alias lsfiles 'ls !* | grep ^-' # very useful! lists files
alias lsln 'ls !* | grep ^l' # sorta useful! lists symlinks
alias lsbig 'ls !* | sort +4' # puts biggest items last
alias lssmall 'ls !* | sort -r +4' # puts smallest items last
alias lsnew 'ls -t' # puts newer items at bottom of listing
alias lsold 'ls -tr' # puts older items at bottom

 

Etc, you get the idea. Anything that you type often can become an alias.
My full aliases (alia?) file is actually two or three times longer than
this, with a lot of lines about connecting to various servers, checking to
see if friends have logged in or out, etc.

Like a lot of these Unix files, an alias archive is something that can
tend to evolve & grow over time, and is easily carried over from one system
to another (e.g. whenever you get a new job, a new computer, etc). Getting
comfortable with this stuff will save you a lot of time in the long run...

[ Reply to This | # ]

aliases
Authored by: tlr on May 05, '01 04:03:39PM

The default file for aliases is
/usr/share/init/tcsh/aliases
here you can find the actual definitions of default aliases, with comment. For instance, one line read:
alias line 'sed -n '''!:1 p''' !:2' # line 5 file => show line 5 of file
which should answer some question ;-)

The recommended way to create new aliases is NOT creating a .tcshrc file, but instead:
1/ Create a directory named "init" in your Library directory (in your home dir), then a directory named "tcsh" inside;
2/ create a text file named "aliases.mine" in that ~/Library/init/tcsh. you can use TextEdit if you remind to save as text. Put your aliases definitions here.



[ Reply to This | # ]