Posted: . At: 11:04 AM. This was 6 years ago. Post ID: 12187
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to list all dotfiles in your home directory with a nice on-liner.


This nice on-liner will list all dotfiles in your home directory that start with b to z. Another good way to accomplish this task.

jason@Yog-Sothoth » ~ » $ ls -hula -d .[b-z]* |grep -v ^d
-rw-------  1 jason jason  13K Jun 20 10:45 .bash_history
-rw-r--r--  1 jason jason  220 Jun 20 10:45 .bash_logout
-rw-rw-r--  1 jason jason  942 Jun 19 11:14 .bashrc
-rw-r--r--  1 jason jason 1.8K Apr  8 09:18 .colorgccrc
-rw-rw-r--  1 jason jason 4.1K Jun 19 11:14 .dircolors
-rw-r--r--  1 jason jason   23 Apr  8 09:18 .dmrc
-rw-------  1 jason jason 1.6K May 30 09:02 .fbtermrc
-rwxrwxr--  1 jason jason   72 Apr  8 09:18 .fehbg
-rw-r-----  1 jason jason    0 Apr  8 09:18 .gksu.lock
-rw-rw-r--  1 jason jason  458 Jun 10 13:42 .gr_fftw_wisdom
-rw-rw-r--  1 jason jason    0 May 30 09:48 .gr_fftw_wisdom.lock
-rw-------  1 jason jason  57K Jun 20 07:58 .ICEauthority
-rw-------  1 jason jason   46 Jun 20 08:55 .lesshst
-rw-------  1 jason jason 6.5K Apr  8 09:18 .mysql_history
-rw-rw-r--  1 jason jason    0 Apr  8 09:18 .nofinger
-rw-rw-r--  1 jason jason 1.7K Jun 19 08:43 .nvidia-settings-rc
-rw-rw-r--  1 jason jason 1.2K Apr  8 09:18 .plan
-rw-r--r--  1 jason jason  675 Jun 20 10:43 .profile
-rw-rw-r--  1 jason jason   34 Apr  8 09:18 .project
-rw-------  1 jason jason  256 Apr  8 09:18 .pulse-cookie
-rw-rw-r--  1 jason jason 1.3K Apr  8 09:18 .quisk_init.pkl
-rw-rw-r--  1 jason jason   72 Jun 20 09:35 .selected_editor
-rw-r--r--  1 jason jason    0 Apr  8 09:18 .sudo_as_admin_successful
-rw-------  1 jason jason  12K Jun 20 09:37 .viminfo
-rwxrwxrwx  1 jason jason 1.4K Jun 20 09:37 .vimrc
-rw-rw-r--  1 jason jason  225 May  8 09:04 .wget-hsts
-rw-------  1 jason jason  114 May 30 09:13 .Xauthority
-rwxrwxr-x  1 jason jason   57 May 30 09:02 .xsession
-rw-------  1 jason jason 496K May 30 09:02 .xsession-errors
-rw-------  1 jason jason  28K May 23 18:09 .xsession-errors.old
-rw-rw-r--  1 jason jason  40K Apr  8 09:18 .zcompdump

Another way to do this.

jason@Yog-Sothoth » ~ » $ ls -hula -d .* |grep -v ^d
-rw-------  1 jason jason  13K Jun 20 10:45 .bash_history
-rw-r--r--  1 jason jason  220 Jun 20 10:45 .bash_logout
-rw-rw-r--  1 jason jason  942 Jun 19 11:14 .bashrc
-rw-r--r--  1 jason jason 1.8K Apr  8 09:18 .colorgccrc
-rw-rw-r--  1 jason jason 4.1K Jun 19 11:14 .dircolors
-rw-r--r--  1 jason jason   23 Apr  8 09:18 .dmrc
-rw-------  1 jason jason 1.6K May 30 09:02 .fbtermrc
-rwxrwxr--  1 jason jason   72 Apr  8 09:18 .fehbg
-rw-r-----  1 jason jason    0 Apr  8 09:18 .gksu.lock
-rw-rw-r--  1 jason jason  458 Jun 10 13:42 .gr_fftw_wisdom
-rw-rw-r--  1 jason jason    0 May 30 09:48 .gr_fftw_wisdom.lock
-rw-------  1 jason jason  57K Jun 20 07:58 .ICEauthority
-rw-------  1 jason jason   46 Jun 20 08:55 .lesshst
-rw-------  1 jason jason 6.5K Apr  8 09:18 .mysql_history
-rw-rw-r--  1 jason jason    0 Apr  8 09:18 .nofinger
-rw-rw-r--  1 jason jason 1.7K Jun 19 08:43 .nvidia-settings-rc
-rw-rw-r--  1 jason jason 1.2K Apr  8 09:18 .plan
-rw-r--r--  1 jason jason  675 Jun 20 10:43 .profile
-rw-rw-r--  1 jason jason   34 Apr  8 09:18 .project
-rw-------  1 jason jason  256 Apr  8 09:18 .pulse-cookie
-rw-rw-r--  1 jason jason 1.3K Apr  8 09:18 .quisk_init.pkl
-rw-rw-r--  1 jason jason   72 Jun 20 09:35 .selected_editor
-rw-r--r--  1 jason jason    0 Apr  8 09:18 .sudo_as_admin_successful
-rw-------  1 jason jason  12K Jun 20 09:37 .viminfo
-rwxrwxrwx  1 jason jason 1.4K Jun 20 09:37 .vimrc
-rw-rw-r--  1 jason jason  225 May  8 09:04 .wget-hsts
-rw-------  1 jason jason  114 May 30 09:13 .Xauthority
-rwxrwxr-x  1 jason jason   57 May 30 09:02 .xsession
-rw-------  1 jason jason 496K May 30 09:02 .xsession-errors
-rw-------  1 jason jason  28K May 23 18:09 .xsession-errors.old
-rw-rw-r--  1 jason jason  40K Apr  8 09:18 .zcompdump

There are a million ways to list files on Linux. But I think these two examples are very useful.

Another way to list a directory and show only files with uppercase filenames.

jason@Yog-Sothoth » ~ » $ echo * | tr " " "\n" | grep [A-Z]
Arma
Desktop
Documents
DOOM00.pcx
DOOM00.png
DOOM01.pcx
Downloads
Firefox_wallpaper.png
FSOL
14_05_1994-vU7rBcEOczM.mp3
Music
Pictures
Public
Templates
Videos
Wordpress
xVideoServiceThief
xVideoServiceThief_downloads

And this is how to list a directory without using ls.

jason@Yog-Sothoth » ubuntu-mate-photos » $ echo * | tr " " "\n"
andrew-ridley-54228.jpg
gabriele-diwald-201135.jpg
johann-siemens-591.jpg
kristopher-roller-110203.jpg
matteo-botto-16023.jpg
nasa-53884.jpg
nattu-adnan-328570.jpg
sebastian-muller-52.jpg
stefan-stefancik-105374.jpg
tommy-lisbin-189189.jpg

Give these tips a try today and show how flexible the Linux command line really is.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.