If you want that, there is another way to achieve that. Though you can see them in individual lines, you cannot distinguish if it's a file or a directory. This is better, right? Here's a screenshot if you want to see them all together in a single image: You can filter them out by using the -A option instead of -a. Now I am going to filter it out so that it only shows the hidden files and directories: ls -a | grep "^\." rw-rw-r- 1 abhishek abhishek 143 May 30 12:06 routes.yaml rw-rw-r- 1 abhishek abhishek 12721 May 29 12:29 members.csv rw-rw-r- 1 abhishek abhishek 4943 Jun 2 20:09 gnome-console-voiceover rw-rw-r- 1 abhishek abhishek 249773 May 26 14:56 cronjob-cheatsheet.png rw-rw-r- 1 abhishek abhishek 29983 May 27 16:07 bash.pdf rw-rw-r- 1 abhishek abhishek 45443 May 24 09:03 apt-get.pdf Here's the content of my sample directory: ls -l With "^\.", you tell grep command to only show results that start with a dot. The dot character needs to be escaped with \ and since you used special characters, everything is enclosed in double-quotes. To display only the hidden files and directories, the simplest approach is to show the hidden files with ls -a and then use grep to filter only the entries that start with a. Display only the hidden files and directories However, you can always find a way to achieve things by combining a few commands through the wonderful pipe redirection. There is no ready-to-use option like -a and -A. What if you want to ONLY see the hidden files, not the regular ones? You can see the hidden files with their names starting with a dot (.).īut you see all the files in the current directory, the hidden ones and the regular ones. You use the ls command in this manner: ls -a Displaying hidden files in Linux is quite easy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |