![]() To use different colors for different file extensions, add the follows to your ~/.bashrc or ~/.zshrc: eval "$(dircolors)" You can remove it if you don't like ISO style time.īy default, the ls command only displays different colors for different file types, such as directory, symbolic link. ![]() -time-style=long-iso: Display time using ISO standard.-author: Display the author of the file in the long format.Using the more natural order 1.txt 2.txt 3.txt 10.txt For example, in a directory with files 1.txt, 2.txt, 3.txt and 10.txt, instead of displaying them with a naive alphabetical order: -v: Display files in the natural order.-color=always: Display colorful output.For example, instead of 625616, 611K is displayed. -h: Display human readable file sizes.For example, directories are appended with /, symbolic links are appended with sockets are appended with =. -F: Indicate different types of files in the output.To use better default options for the ls command, add the follows to your ~/.bashrc or ~/.zshrc: alias ls='ls -F -h -color=always -v -author -time-style=long-iso' Step by Step to Build the Configuration Better Default ls Command Line Options If it shows ls is an alias, which is possibly set by some system-wide configuration file, you need to unalias it by adding unalias ls to your ~/.bashrc or ~/.zshrc. If it does not work for you, make sure you have restarted your shell and check the output of which ls. The ll and l commands are for the long-format output. >/dev/null 2>&1 then # GNU lsĮxport COLUMNS # Remember columns for subprocesses.Ĭommand ls -F -h -color=always -v -author -time-style=long-iso -C | less -R -X -F If you are not on GNU/Linux or cygwin, here is the installation instruction for macOS and FreeBSD.įor the impatient, add the following to your ~/.bashrc if you use bash or ~/.zshrc if you use zsh: if ls -color -d. Usually it is the default ls on GNU/Linux and cygwin. You can execute ls -version to check whether you are using GNU ls: If it prints ls (GNU coreutils), it means you are using GNU ls if not, you can install it on your system. This is because it provides all the features we want to have and is perhaps the most powerful ls command in the world, at least as far as I know. In this post, the version of the ls program we will use is GNU ls-that is, the ls program from GNU Coreutils.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |