1

I was searching for my vimrc so I could change my settings in vim, but was struggling to find it. I followed this which gave me the directory of the vimrc (user/home/.vimrc) that my vim is currently using, but when I went into home and hit ls to find the file, there was nothing that said .vimrc or vimrc. However, when I typed vim .vimrc in that same directory, I was able to open the file.

I am very new to everything Linux, so I don't know what exactly I am getting wrong; does ls not list all the files in a directory, or is .vimrc an exceptional file type?

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

3

Any file that is preceded by . is a hidden file. ls will not show hidden files by default.

You can use the -a(all flag) to display ALL files.

$ ls -a
.
..
00001ea3_medium.jpeg
video.mp4

Using the -l (long listing flag) will display more information regarding the files:

$ ls -al
-rw-rw-r--   1 za   za             7275 Apr  7 00:59  .xboardrc
-rwxr-xr-x   1 za   za              131 Apr 20  2017  .xinputrc
-rwxr-xr-x   1 za   za             8099 Apr 19  2017  .xscreensaver
-rw-------   1 za   za             3569 Jun 13 03:51  .xsession-errors
-rw-------   1 za   za             3569 Jun 12 22:28  .xsession-errors.old

You can read more about the ls command by reading the manpage online or from terminal:

man ls

To filter the results you can use grep in combination with ls.

$ ls -al | grep vim
drwxr-xr-x   2 za   za             4096 May 15 02:53 .vim
-rwxr-xr-x   1 za   za            15049 May 25 21:51 .viminfo
Kulfy
  • 17,696
Don Su
  • 141