Here is the output of my normal ls command:  f1  f10  f11  f12  f13  f14  f15  f16  f17  f18  f19  f2  f20  f3  f4  f5  f6  f7  f8  f9   So I have 20 files. I need them displayed as :  f1  f2 f3  f4  f5  f6  f7  f8  f9 f10  f11  f12  f13  f14  f15  f16  f17  f18  f19  f20     Is there any single-line command to this other than writing a script? I am sure some of you must have faced this weird situation. Note: the above is just a sample. In the actual scenario I need a list of all the file names in proper sorted order. (ranging from f{0..10000})
27547
I have a bunch of files from log1 to log164.  I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this:  home:logs Home$ ls -1 | sort log1.gz log10.gz log100.gz log101.gz log102.gz log103.gz log104.gz log105.gz log106.gz ...etc   What I want is  home:logs Home$ ls -1 | sort log1.gz log2.gz log3.gz log4.gz log5.gz log6.gz log7.gz ...{more here} log99.gz log100.gz log101.gz log102.gz ...etc   Any suggestions in what I could use to do this?
34938
I have lists of files that contain a few columns of data. It is not sorted the way I want from the output, so I'm manually hunting for where a line should be. Is there a way in Notepad++ to sort the lines alphabetically? If so, how?
44735
I have got the directory called Test and a few directories inside it. Both Test and the directories inside it have executable files. I'd like to print them with ls. I'd use this command.  ls -l `find Test/ -perm /u=x,g=x,o=x -type f`   Is this a good/right/quick command or not?  My solution is:  find Test/ -executable -type f -exec ls -l {} \;   and got the same result as warl0ck and pradeepchhetri offered.
2420
What do the different colours in Ubuntu's ls command mean? For example, when I type the ls command in one of my folders, I get one of the files in light green, the other (which is a folder) in blue with green highlighting.   What do those colours mean, and there is any manual about all the colours?
14187
Why does $ ls &gt; ls.out cause 'ls.out' to be included in list of names of files in current directory? Why was this chosen to be? Why not otherwise?
93107
When i am using these commands , i am getting the same output but only order is getting changed for ls -ltr command. Can anyone please tell me what is the difference between the below commands?   ll ls -l ls -ltr
115569
What is the best way, using Bash, to rename files in the form:  (foo1, foo2, ..., foo1300, ..., fooN)   With zero-padded file names:  (foo00001, foo00002, ..., foo01300, ..., fooN)
48702
The output of ls -l command yields the following result:    What is the number field between file permission and owner? i.e. what are those 1, 1, 1, and 2? I checked the --help but that doesn't explain it.  [EDIT]  I thought it was the number of files in a directory but it isn't. See image. "tempFolder" has 3 files but still show a "2"
22476
I've just been fooling around with some code in C, an example of a really basic program is as follows which just, obviously, lists the directories using the ls system command.  #include &lt;stdio.h&gt;  int main (void) {     system("ls -l -d */");     printf("I've just listed the directories :-)\n");     return 0; }   This runs fine, but it shows the ls output in monochrome, whereas Bash would output the list using colors for the directories (or files if I included files). How can I make my C code use the bash colors? Thanks
41853
I want to remove all the files from different directories, and want to keep only latest files 20 files. is this the correct command to do this?  ls -t1 /mnt/dwh/ftp/dwh_ftp_cbs/ARLOGS/ | tail -n +22 | xargs rm -f
48411
To create a playlist for all of the music in a folder, I am using the following command in bash:  ls &gt; list.txt   I would like to use the result of the pwd command for the name of the playlist.  Something like:  ls &gt; ${pwd}.txt   That doesn't work though - can anyone tell me what syntax I need to use to do something like this?  Edit: As mentioned in the comments pwd will end up giving an absolute path, so my playlist will end up being named .txt in some directory - d'oh! So I'll have to trim the path. Thanks for spotting that - I would probably have spent ages wondering where my files went!
100185
I was looking at   and I wondered if the following could be done from terminal. I did it in python, just want to see if it could be done from terminal, bash scripting or whatever.  Suppose I have a file that looks like so:  2,4,5,14,9 40,3,5,10,1   could it be sorted like so, by rows (lines)  2,4,5,9,14 1,3,5,10,40   or is it too complicated? I did it using python, I just want to know if it could be done so next time I might not use python. What I have done, is creating lists and sorting them.
111963
Is there a way to list a set of say, 30 random files from a directory using standard Linux commands? (in zsh)  The top answer described  does not work for me (sort does not recognize the option -R)
55005
What would be the best way to list 100 first files in a directory sorted by the created timestamp (oldest first). The directory is quite large (around 100000 files). ls piped to head takes an awful long time to complete.   Edit:  Filesystem is ext3. limiting the number of files in the folder is not worth the effort, since this is going to be a rare "clean-up" operation and files are generated by a 3rd party software.   Using file modified time, instead of the creation time provides and acceptable solution.
92334
When I do ls -l I get this:  calico@A000505:~/Documentos$ ls -l total 2020 -rwxr-xr-x 1 calico calico    8559 2010-11-16 11:12 a.out -rwxrw-rw- 1 smt    smt    2050138 2010-10-14 10:40 Java2.pdf -rwxrw-rw- 1 ocv    ocv        234 2010-11-16 11:11 test.c   But what does the "total 2020" mean? I only have 3 files so it's not the number of files or directories, and I guess it's not the size either. So what is it?
70440
I've been studying about the command line and learned that | (pipeline) is meant to redirect the output from a command to the input of another one. So why does the command ls | file doesn't work?  file input is one of more filenames, like file filename1 filename2  ls output is a list of directories and files on a folder, so I thought ls | file was supposed to show the file type of every file on a folder.  When I use it however, the output is:      Usage: file [-bcEhikLlNnprsvz0] [--apple] [--mime-encoding] [--mime-type]         [-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...     file -C [-m magicfiles]     file [--help]   As there was some error with the usage of the file command
33970
I am trying to get a list of open files per process. I ran the following one-liner from :  lsof | perl -lane '$x{"$F[0]:$F[1]"}++; END { print "$x{$_}\t$_" for sort {$x{$a}&lt;=&gt;$x{$b}} keys %x}'   It returns the total count of open files, and the process name and pid. The result is sorted in ascending order, and the last line is as follows:  1065702 java:15437   So when I run lsof -p 15437, I would expect it to return the same number, however I'm getting:  $ lsof -p 15437 | wc -l 403   Why the discrepancy?  Addendum  A third source of discrepancy:  $ cd /proc/15437/fd $ ls -1 | wc -l 216