Avatar of Vemont
Vemont

asked on 

bash

Is there a way to list all the files(not directories) in a directory that starts with some letter, with the use of ls and grep ? When I say all files, I mean files with extension and files without extension. I know how to do it with a for loop, but I don't know how to do it with ls and grep.
Linux OS Dev

Avatar of undefined
Last Comment
Vemont
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Vemont
Vemont

ASKER

ls -F a*|grep -v / won't work on all systems because they don't all use / at the end of directories. It will probably work on Linux though.
Avatar of Tintin
Tintin

Vemont.

What systems won't display a / for directories using 'ls -F'?

Certainly works on all Linux systems, Solaris, FreeBSD, openBSD, AIX
Avatar of Vemont
Vemont

ASKER

OK, you're right, I thought it wouldn't work on Solaris, but it did. Thanks! :)
Linux OS Dev
Linux OS Dev

Kernel programming for Linux operating systems can be done with many different languages; C, C++, Python, Perl and Java, which are some of the most common languages used.There are also many different varieties of Linux, such as Ubuntu, Fedora and OpenSUSE.

10K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo