How can I make ls only display files?How do I create a permanent Bash alias?listing files in a directory without listing subdirectories and their contents in that directoryPreserving multi-column output from ls when pagingHow to Search for Files Recursively into SubdirectoriesHow to list all files within subdirectories without the path?ls command is only showing files, and no folders (spaces? instead of them)Using the ls command on an Ubuntu 14.04.10 server to explore my filesWhat does `ls --directory` stand for?Anything like Scroll Lock key in the bash of Linux subsystem in windows 10ls command: Show time only (in iso-format)How to display number of items in sub-directories from command line
Can I leave my car sitting outside for about 5 years?
Can I ignore an open source license if I checkout a version that was released prior to the license being added
Are unitarily equivalent permutation matrices permutation similar?
Aligning the Arrows
How did the Druids learn the Greek language by the time of Caesar's campaign in Gaul?
Why doesn't knowledge of how magic works break magic in this world?
How to teach children Santa is not real, while respecting other kids beliefs?
Expectation of 500 coin flips after 500 realizations
Who created Avada Kedavra?
writing Vec compare in a more compact way
How to stretch this Venn diagram?
Would a level 18+ Champion Fighter recover HP outside of combat?
How do you get to this trap position?
Do any countries have a pensions system funded entirely by past contributions, rather than current taxes?
"Dog" can mean "something of an inferior quality". What animals do we use, if any, to describe the opposite?
When is it not okay to cheap out on bike parts?
How to translate “就这么着吧”?
I shift the source code, you shift the input!
Why is "runway behind you" useless?
What does it mean to play in a mode?
Fourier transform is an isomorphism...but we don’t get when each frequency appears?
Was a four year-old forced to sleep on the floor of Leeds General Infirmary?
Is Nessa or Vanessa a Catholic name?
Replying an email
How can I make ls only display files?
How do I create a permanent Bash alias?listing files in a directory without listing subdirectories and their contents in that directoryPreserving multi-column output from ls when pagingHow to Search for Files Recursively into SubdirectoriesHow to list all files within subdirectories without the path?ls command is only showing files, and no folders (spaces? instead of them)Using the ls command on an Ubuntu 14.04.10 server to explore my filesWhat does `ls --directory` stand for?Anything like Scroll Lock key in the bash of Linux subsystem in windows 10ls command: Show time only (in iso-format)How to display number of items in sub-directories from command line
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious
ls
add a comment
|
I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious
ls
Not sure aboutls
, but you can easily do it with thefile
command:file /directory/containing/the/files -maxdepth 1 -not -type d
.
– Henning Kockerbeck
Aug 11 '16 at 22:03
1
Another way would be to filter the output ofls
throughgrep
, something likels -1F /directory/containing/the/files | grep -vE /$
. But be aware that parsing the output of ls can be tricky.
– Henning Kockerbeck
Aug 11 '16 at 22:08
2
askubuntu.com/questions/289321/…
– Rinzwind
Aug 11 '16 at 23:01
add a comment
|
I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious
ls
I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious
ls
ls
asked Aug 11 '16 at 21:54
thinksinbinarythinksinbinary
7492 gold badges9 silver badges19 bronze badges
7492 gold badges9 silver badges19 bronze badges
Not sure aboutls
, but you can easily do it with thefile
command:file /directory/containing/the/files -maxdepth 1 -not -type d
.
– Henning Kockerbeck
Aug 11 '16 at 22:03
1
Another way would be to filter the output ofls
throughgrep
, something likels -1F /directory/containing/the/files | grep -vE /$
. But be aware that parsing the output of ls can be tricky.
– Henning Kockerbeck
Aug 11 '16 at 22:08
2
askubuntu.com/questions/289321/…
– Rinzwind
Aug 11 '16 at 23:01
add a comment
|
Not sure aboutls
, but you can easily do it with thefile
command:file /directory/containing/the/files -maxdepth 1 -not -type d
.
– Henning Kockerbeck
Aug 11 '16 at 22:03
1
Another way would be to filter the output ofls
throughgrep
, something likels -1F /directory/containing/the/files | grep -vE /$
. But be aware that parsing the output of ls can be tricky.
– Henning Kockerbeck
Aug 11 '16 at 22:08
2
askubuntu.com/questions/289321/…
– Rinzwind
Aug 11 '16 at 23:01
Not sure about
ls
, but you can easily do it with the file
command: file /directory/containing/the/files -maxdepth 1 -not -type d
.– Henning Kockerbeck
Aug 11 '16 at 22:03
Not sure about
ls
, but you can easily do it with the file
command: file /directory/containing/the/files -maxdepth 1 -not -type d
.– Henning Kockerbeck
Aug 11 '16 at 22:03
1
1
Another way would be to filter the output of
ls
through grep
, something like ls -1F /directory/containing/the/files | grep -vE /$
. But be aware that parsing the output of ls can be tricky.– Henning Kockerbeck
Aug 11 '16 at 22:08
Another way would be to filter the output of
ls
through grep
, something like ls -1F /directory/containing/the/files | grep -vE /$
. But be aware that parsing the output of ls can be tricky.– Henning Kockerbeck
Aug 11 '16 at 22:08
2
2
askubuntu.com/questions/289321/…
– Rinzwind
Aug 11 '16 at 23:01
askubuntu.com/questions/289321/…
– Rinzwind
Aug 11 '16 at 23:01
add a comment
|
5 Answers
5
active
oldest
votes
ls -p | grep -v /
Using ls -p
tells ls
to append a slash to entries which are a directory, and using grep -v /
tells grep
to return only lines not containing a slash.
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
@sdkks You don't need the1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.
– thomasrutter
Aug 21 '16 at 23:27
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
add a comment
|
You may try this:
find . -maxdepth 1 -not -type d
And map this to a special alias.
But if you're really keen on using the ls
command, here:
ls -p | egrep -v /$
add a comment
|
Alternatively:
ls -lAh | grep -v '^d'
This method lists in
-l
Long list format-A
Displays almost all (show hidden files but don't show.
and..
)-h
Human readable file sizes
while grep
-v
Don't show matching recordsRegular expression
filter^d
- Those start with letter d (for directory) i.edrwxrwxr-x <some file details> <foldername>
If you don't want to type every time, you may make it into an alias for your bash/shell profile.
add a comment
|
I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:
ls -pr | grep -v / | column
-p adds the forward slash ('/') to the directory names
-r reverses the order of output
-v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)- "column puts it in columns" - Captain Obvious
1
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
add a comment
|
ls -F | grep -v /
Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.
ls -F
appends symbols to filenames. These symbols show useful information about files.
@
means symbolic link (or that the file has extended attributes).*
means executable.=
means socket.|
means named pipe.>
means door./
means directory.
ls -F | grep -Ev '/|@|*|=|>||'
Above command displays only files.
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f811210%2fhow-can-i-make-ls-only-display-files%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
ls -p | grep -v /
Using ls -p
tells ls
to append a slash to entries which are a directory, and using grep -v /
tells grep
to return only lines not containing a slash.
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
@sdkks You don't need the1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.
– thomasrutter
Aug 21 '16 at 23:27
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
add a comment
|
ls -p | grep -v /
Using ls -p
tells ls
to append a slash to entries which are a directory, and using grep -v /
tells grep
to return only lines not containing a slash.
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
@sdkks You don't need the1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.
– thomasrutter
Aug 21 '16 at 23:27
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
add a comment
|
ls -p | grep -v /
Using ls -p
tells ls
to append a slash to entries which are a directory, and using grep -v /
tells grep
to return only lines not containing a slash.
ls -p | grep -v /
Using ls -p
tells ls
to append a slash to entries which are a directory, and using grep -v /
tells grep
to return only lines not containing a slash.
answered Aug 11 '16 at 23:53
thomasrutterthomasrutter
29.2k4 gold badges72 silver badges92 bronze badges
29.2k4 gold badges72 silver badges92 bronze badges
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
@sdkks You don't need the1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.
– thomasrutter
Aug 21 '16 at 23:27
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
add a comment
|
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
@sdkks You don't need the1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.
– thomasrutter
Aug 21 '16 at 23:27
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
I checked this one because it's my favorite answer (while i did upvote all of them), but now trying to find a way to put it in columns and reverse the order of output...
– thinksinbinary
Aug 12 '16 at 12:11
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
"You can use 1 switch for single column list" sorry, i did try to figure out what you meant by that, i would appreciate and example/explanation if you would, i only know what a switch is in regards to C programming
– thinksinbinary
Aug 19 '16 at 0:30
@sdkks You don't need the
1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.– thomasrutter
Aug 21 '16 at 23:27
@sdkks You don't need the
1
switch when piping the output as it will default to single column in that situation. If that is what you were meaning.– thomasrutter
Aug 21 '16 at 23:27
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
@thinksinbinary not sure how to make it multi column but you could search for or ask your own separate question and someone will know.
– thomasrutter
Aug 21 '16 at 23:28
add a comment
|
You may try this:
find . -maxdepth 1 -not -type d
And map this to a special alias.
But if you're really keen on using the ls
command, here:
ls -p | egrep -v /$
add a comment
|
You may try this:
find . -maxdepth 1 -not -type d
And map this to a special alias.
But if you're really keen on using the ls
command, here:
ls -p | egrep -v /$
add a comment
|
You may try this:
find . -maxdepth 1 -not -type d
And map this to a special alias.
But if you're really keen on using the ls
command, here:
ls -p | egrep -v /$
You may try this:
find . -maxdepth 1 -not -type d
And map this to a special alias.
But if you're really keen on using the ls
command, here:
ls -p | egrep -v /$
answered Aug 11 '16 at 23:07
theabhinavdastheabhinavdas
3381 silver badge6 bronze badges
3381 silver badge6 bronze badges
add a comment
|
add a comment
|
Alternatively:
ls -lAh | grep -v '^d'
This method lists in
-l
Long list format-A
Displays almost all (show hidden files but don't show.
and..
)-h
Human readable file sizes
while grep
-v
Don't show matching recordsRegular expression
filter^d
- Those start with letter d (for directory) i.edrwxrwxr-x <some file details> <foldername>
If you don't want to type every time, you may make it into an alias for your bash/shell profile.
add a comment
|
Alternatively:
ls -lAh | grep -v '^d'
This method lists in
-l
Long list format-A
Displays almost all (show hidden files but don't show.
and..
)-h
Human readable file sizes
while grep
-v
Don't show matching recordsRegular expression
filter^d
- Those start with letter d (for directory) i.edrwxrwxr-x <some file details> <foldername>
If you don't want to type every time, you may make it into an alias for your bash/shell profile.
add a comment
|
Alternatively:
ls -lAh | grep -v '^d'
This method lists in
-l
Long list format-A
Displays almost all (show hidden files but don't show.
and..
)-h
Human readable file sizes
while grep
-v
Don't show matching recordsRegular expression
filter^d
- Those start with letter d (for directory) i.edrwxrwxr-x <some file details> <foldername>
If you don't want to type every time, you may make it into an alias for your bash/shell profile.
Alternatively:
ls -lAh | grep -v '^d'
This method lists in
-l
Long list format-A
Displays almost all (show hidden files but don't show.
and..
)-h
Human readable file sizes
while grep
-v
Don't show matching recordsRegular expression
filter^d
- Those start with letter d (for directory) i.edrwxrwxr-x <some file details> <foldername>
If you don't want to type every time, you may make it into an alias for your bash/shell profile.
edited Apr 13 '17 at 12:23
Community♦
1
1
answered Aug 12 '16 at 2:38
sdkkssdkks
1,2131 gold badge9 silver badges9 bronze badges
1,2131 gold badge9 silver badges9 bronze badges
add a comment
|
add a comment
|
I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:
ls -pr | grep -v / | column
-p adds the forward slash ('/') to the directory names
-r reverses the order of output
-v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)- "column puts it in columns" - Captain Obvious
1
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
add a comment
|
I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:
ls -pr | grep -v / | column
-p adds the forward slash ('/') to the directory names
-r reverses the order of output
-v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)- "column puts it in columns" - Captain Obvious
1
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
add a comment
|
I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:
ls -pr | grep -v / | column
-p adds the forward slash ('/') to the directory names
-r reverses the order of output
-v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)- "column puts it in columns" - Captain Obvious
I saw in your( @thinksinbinary ) comment on the answer by @thomasrutter , that you wanted to be able to print them in reverse order and in columns. You probably have already figured it out or moved on, but here it is:
ls -pr | grep -v / | column
-p adds the forward slash ('/') to the directory names
-r reverses the order of output
-v lets grep do an inverse search to print everything except the directories (everything that doesn't have the '/' that -p put there)- "column puts it in columns" - Captain Obvious
answered Oct 29 at 15:14
Levi UzodikeLevi Uzodike
211 bronze badge
211 bronze badge
1
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
add a comment
|
1
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
1
1
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
i do think it's cool that on the ubuntu forum people still comment on and read your posts after a long time. I've been wanting to get back into linux in order to learn assembly and operating systems since doing so on windows is much more difficult. Thanks!
– thinksinbinary
Oct 30 at 22:22
add a comment
|
ls -F | grep -v /
Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.
ls -F
appends symbols to filenames. These symbols show useful information about files.
@
means symbolic link (or that the file has extended attributes).*
means executable.=
means socket.|
means named pipe.>
means door./
means directory.
ls -F | grep -Ev '/|@|*|=|>||'
Above command displays only files.
add a comment
|
ls -F | grep -v /
Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.
ls -F
appends symbols to filenames. These symbols show useful information about files.
@
means symbolic link (or that the file has extended attributes).*
means executable.=
means socket.|
means named pipe.>
means door./
means directory.
ls -F | grep -Ev '/|@|*|=|>||'
Above command displays only files.
add a comment
|
ls -F | grep -v /
Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.
ls -F
appends symbols to filenames. These symbols show useful information about files.
@
means symbolic link (or that the file has extended attributes).*
means executable.=
means socket.|
means named pipe.>
means door./
means directory.
ls -F | grep -Ev '/|@|*|=|>||'
Above command displays only files.
ls -F | grep -v /
Above command displays files, But it includes symlinks, pipes, etc. If you want to eliminate them too, you can use one of the flags mentioned below.
ls -F
appends symbols to filenames. These symbols show useful information about files.
@
means symbolic link (or that the file has extended attributes).*
means executable.=
means socket.|
means named pipe.>
means door./
means directory.
ls -F | grep -Ev '/|@|*|=|>||'
Above command displays only files.
answered Sep 30 at 7:00
BarathVutukuriBarathVutukuri
1262 bronze badges
1262 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f811210%2fhow-can-i-make-ls-only-display-files%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Not sure about
ls
, but you can easily do it with thefile
command:file /directory/containing/the/files -maxdepth 1 -not -type d
.– Henning Kockerbeck
Aug 11 '16 at 22:03
1
Another way would be to filter the output of
ls
throughgrep
, something likels -1F /directory/containing/the/files | grep -vE /$
. But be aware that parsing the output of ls can be tricky.– Henning Kockerbeck
Aug 11 '16 at 22:08
2
askubuntu.com/questions/289321/…
– Rinzwind
Aug 11 '16 at 23:01