{ads}

Finding files on Linux with the longest names



July 06, 2022 at 02:30AM

File names on Linux systems can be as long as 255 characters. While determining which files in a directory have the longest names might not be the most exciting task at hand, doing this with a script poses some interesting challenges that invite equally interesting solutions.

To start, consider passing the output of the ls command, which is used to list files, to a wc command that counts the characters like this:

$ ls myreport.txt | wc -c
13

If you counted the letters in “myreport.txt” by looking at “myreport.txt”, you likely noticed that there are 12, not 13 letters in that file name. This is because, just as in the command below, echo sends the requested text through the pipe along with a newline character at the end.

To read this article in full, please click here



from Network World https://ift.tt/GSHt34A

0 Response to "Finding files on Linux with the longest names"

Post a Comment

Article Top Ads

Central Ads Article 1

Middle Ads Article 2

Article Bottom Ads