Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all files not starting with a number

I want to examine the all the key files present in my /proc. But /proc has innumerable directories corresponding to the running processes. I don't want these directories to be listed. All these directories' names contain only numbers. As I am poor in regular expressions, can anyone tell me whats the regex that I need to send to ls to make it NOT to search files/directories which have numbers in their name?

UPDATE: Thanks to all the replies! But I would love to have a ls alone solution instead of ls+grep solution. The ls alone solutions offered till now doesn't seem to be working!

like image 739
Pavan Manjunath Avatar asked Mar 01 '12 11:03

Pavan Manjunath


People also ask

How can you list all file names beginning with S?

Explanation: We use ls command in terminal to list all the directories,sub directories,files….. We have to filter the files that starts with t or s in the current directory. ... We have to filter the file names by using regular expressions. ... s -ld /etc/[ts]* | grep ^- | tr -s ' ' | cut -d' ' -f9.

How do I list files by size order?

To list all files and sort them by size, use the -S option. By default, it displays output in descending order (biggest to smallest in size). You can output the file sizes in human-readable format by adding the -h option as shown. And to sort in reverse order, add the -r flag as follows.

How do I get a list of all files on my computer?

For Windows 10, follow these instructions: Hold the windows key and press "r," type in "cmd" and then press enter, type in "cd ../.." and then press enter, type in "tree" and then press enter. This will usually show all of the files on your hard drive.


1 Answers

You don't need grep, just ls:

ls -ad /proc/[^0-9]*

if you want to search the whole subdirectory structure use find:

find /proc/ -type f -regex "[^0-9]*" -print
like image 163
Mithrandir Avatar answered Sep 30 '22 17:09

Mithrandir