User Tools

Site Tools


linux:ls-iso

This is an old revision of the document!


ISO date in ls -l

By default, the ls command shows a short and inconsistent date/time column. No year is being displayed if the file is less than a year old. To change this behaviour and always display the full iso date and time, edit ~/.bashrc and adjust or add the ls alias line like so:

    alias ls='ls --color=auto --time-style=long-iso'

Then log out and back into the terminal or use the following command to apply the config change:

source ~/.bashrc

On other shells, it may have to be added to .profile. If an alias is not the preferred way, the default time-style can be set using the environment variable TIME_STYLE either via .bashrc or .profile or system-wide in /etc/profile

export TIME_STYLE="long-iso"
linux/ls-iso.1517426139.txt.gz · Last modified: 2023/05/29 11:53 (external edit)