How can I set default arguments for "ls" in Linux? [closed]
Asked Answered
C

3

22

Im constantly doing "ls -ahl" whenever I want to list what is in the directory. Is there a way for me to make -ahl the default args passed when I do "ls" or should I just create an alias like "alias lsa=ls -ahl" in bash_profile?

Cita answered 2/2, 2012 at 21:38 Comment(0)
R
32

You could just alias ls itself. So something like:

alias ls='ls -ahl'
Resect answered 2/2, 2012 at 21:40 Comment(1)
you can but it can be annoying if you forget you've done it better to just use a fresh command imoAlanson
H
23

Set an alias in your ~/.bash_profile file.

alias ls="ls -ahl"

A couple of common aliases that I use all the time are:

alias ll="ls -lh --color"
alias l="ls -1"
Hood answered 2/2, 2012 at 21:43 Comment(0)
G
4

Create an alias in your .bashrc. You can even call it ls and override the program.

Gitlow answered 2/2, 2012 at 21:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.