The command to list the contents of a folder/directory in Unix and Unix-like systems.

learn more… | top users | synonyms

2
votes
0answers
28 views

How to get fish-style formatting with less

Let's say I run a command like ls in fish and get lots of output, how do I scroll through it and still keep the fish formatting or something like it? ls | less doesn't keep the formatting. I know ...
6
votes
3answers
154 views

Linux: How could a directory be created without “.” and “..”?

I am not sure if the following issue is specific to busybox: I have an embedded device with busybox installed. From what I understand, when a directory is created, usually 2 hidden files will be ...
0
votes
0answers
17 views

Cannot start Tomcat server from Mac terminal?

I am trying to start the Tomcat server on my Mac. When I navigate to the bin folder, the startup.sh file is there but when I try to run it, it says the file doesn't exist: quickCoder-MacBook-Air:bin ...
1
vote
2answers
32 views

Ordering of filenames in linux - not purely lexicographical?

Given a few files in a directory data the following ls command provides a surprising result in the sense of how they are ordered: for f in data/*; do echo $f; done ...
10
votes
4answers
6k views

How to list files recursively and sort them by modification time?

How do I list all files under a directory recursively and sort the output by modification time? I normally use ls -lhtc but it doesn't find all files recursively. I am using Linux and Mac. ls -l on ...
4
votes
4answers
8k views

Recursively list full absolute path of files with permissions in Linux

I have done a bit of searching online, and I am trying to find a way to recursively list all files with their absolute path and with their permissions. I want to do this so that I can grep out what I ...
1
vote
1answer
18 views

ls colors disappear after running zsh

I installed the latest version of zsh on my osx using brew and then went ahead and installed oh-my-zsh. Everything is fine and dandy, but where did my ls colors go? If I run a bash -l inside of that ...
1
vote
2answers
60 views

Alternative to 'ls -A' in Bash

Is there an alternative to ls -A command in native bash functions? Wildcard * isn't the same. I tried hard to find one, but echo * doesn't show hidden files.
5
votes
4answers
767 views

How to turn off --classify option in ls command?

My ls command is aliased to have certain options automatically applied, including --classify (same as -F) Normally this is fine and I don't want to screw around with my .bashrc file. Just this one ...
43
votes
7answers
65k views

How to list folders using bash commands?

Is there any way to list just the folders in a directory using bash commands? ( as the ls command lists all the files and folders )
1
vote
2answers
23 views

Finding php files that have numbers in the filename

Can someone help me with a command line to find all .php files on a server with a number in the filename? I have searched, as best I can, for other answers, but they typically show for a specific ...
5
votes
3answers
1k views

is there a way to read the cumulative size of all files in a folder?

I want to read the size of a folder from the command line. ls -lh shows all folders as being 4k, which presumably is the size of the footprint of the folder itself, rather than the contained files. ...
0
votes
1answer
457 views

Why doesn't ls show the group name?

When I use ls -l, it does NOT show the group names in the listings. Only the user names. aj@host:/media/storage$ ll total 724 drwxrwxrwx 10 root 4096 Sep 17 18:23 . drwxr-xr-x 3 root ...
144
votes
3answers
6k views

On OS X, why does sudo ls show hidden (dot) files?

With OS X Yosemite, using the following commands, I get the following: $ touch .a $ touch b $ /bin/ls b $ /bin/ls -A .a b $ sudo /bin/ls .a b It shows hidden files (that have names starting with ...
9
votes
3answers
830 views

What does third symbol in “rw-” file mode mean in OS X ls manual page?

I have trouble understanding ls's manual regarding a file that has rw- mode. Here's the quote: If r, the file is readable; if −, it is not readable. If w, the file is writable; if −, it is ...
7
votes
3answers
436 views

Bash: ls * without folder grouping

If I type: ls source/* source/fonts: fontello source/images: bg1.png eng.png fra.png I get the list of files, grouped by folder names. How can I simply get the list of ...
0
votes
0answers
38 views

Why “ls” command highlights some folders?

Why LS highlights folder PyFac ? How disable this highlighting? IMG My .profile: if [ -f $(brew --prefix)/etc/bash_completion ]; then . $(brew --prefix)/etc/bash_completion fi export CLICOLOR=1 ...
602
votes
7answers
399k views
0
votes
1answer
27 views

When in ~ directory, why doesn't ls show /usr/ directory?

I can cd /usr/, but why doesn't ls -a or ls -d or ls -d */ show me that the usr directory is there? I have already seen this question, but ls -d */ yields ls: cannot access */: No such file or ...
47
votes
10answers
33k views

Unix: ls, how to sort first directories then files etc

I would like to use ls command to first show direcotries and then files. I tried ls -la | sort -k 1 But I got a wrong order.
7
votes
2answers
1k views

Vi can write to file despite file being read-only

The following example show how to create a file with only read permissions. As we can see, when I try to write to this file using the echo command I get, Permission denied. But why, in the case that ...
-2
votes
1answer
571 views

ls -ltr command in UNIX and Linux - Behaviour

Why does ls -ltr show different total? We have same files in both unix and linux environment please refer BELOW UNIX > ls -ltr /A/B/C/ total 2140 -rwxr--r-- 1 demo demo 14415 May 30 ...
0
votes
1answer
77 views

ls linux command: how to filter files in other directories

I know what ls folder/ and ls *abc* do in linux. I want to filter out some files in a specific folder. I tried this: ls folder/ *abc but it does not return correct values. Any idea? Thanks
1
vote
1answer
38 views

Head waits for full stdin before printing

When one runs ls | head head seems to wait for the full output of the piped command before printing to screen. This is undesirable when the command will take a very long time to run, such as when ...
2
votes
2answers
2k views

How to change the default --color preference for "ls' on Windows?

I'm using ls (from Msys) on Windows. By default, ls doesn't colour-code directories and archives, but that's something I want. I'm tired of typing "ls -C" and "ls --color". Is there any way apart from ...
34
votes
6answers
21k views

How do I get ls --color=auto to work on Mac OS X?

I'm trying to move my bash configuration from Ubuntu to Mac OS X and it looks like ls is slightly different. For instance, it won't accept the --color option. How do I get this to work?
0
votes
1answer
25 views

Why are filename ordering rules different on graphical/non-graphical linux programs?

Here is the output of an ls: x-15.txt x-1617.txt x-2411.txt x-24.txt x-ae.txt x-afag.txt x-bdaa.txt x-bd.txt Note that x-1617 comes before x-24 and the same ordering rule seems to apply to the ...
19
votes
3answers
3k views

How can I make “ls” show dotfiles first?

Somewhere along the way I screwed up my ls command and now I get this ordering when running $ ls -AhHl --color=auto -rwxr-xr-x 1 clang clang 640 Mar 1 02:46 apple-touch-icon-precomposed.png ...
0
votes
1answer
181 views

Linux bash command to list hidden files first, then other files sorted by extension

This page: How can I make "ls" show dotfiles first? lets me list hidden files first, but I also wish to sort non-hidden files by "extension" e.g. all filenames ending with ".png" come after ...
2
votes
1answer
138 views

Completely hide files on Linux

i was wondering if there's a way to prevent a ls -a command to display certain files to certain user/group The criteria could be: if the file is hidden and the user/group has no read access, then ...
0
votes
2answers
736 views

du and ls report different directory size?

In trying to verify that a copy-operation completed successfully (or at least that it didn't skip any files), I ran du -b inside the source and destination directory and it showed a difference of ...
1
vote
2answers
248 views

Can `ls` be set to only list the first X files/directories?

I'm trying to make a command which only displays the first 30 files when the ls command is invoked. I found this method... ls | head -30 ... but it ends up spitting out the files in one long list, ...
4
votes
1answer
4k views

What does the + mean in the output of “ls -l”?

ls -l -rwxr-xr-x 1 root root 885 2010-07-08 13:55 /etc/backup-number-of-files* -rwxrwxr-x+ 1 levchuk Users 1067 2010-08-30 14:37 /etc/backup-running-time* Please notice the + on the 2nd ...
1
vote
3answers
480 views

Ignore NTUSER.DAT files when ls on Git Bash?

I use Git Bash as my terminal on Windows. When I ls in my Home directory, I see some NTUSER.DAT entries, which I assume are system files. They don't appear when I run dir in the default Windows ...
0
votes
1answer
63 views

an ssh subsystem that does ls

Normally you create a subsystem by doing Subsystem vim /usr/bin/vim or something like that. So how would I do a subsystem that did ls -la? ie. you call the ls subsystem, it gives you an ls and then ...
4
votes
1answer
202 views

Why does the ls command require a dash before its parameters but for tar command, the dash is optional?

I am new to Ubuntu and I am trying hard to understand the command line. When I want to see the contents of a tar file I use: tar tf tarfile.tar But when I want to see a listing of all file if I ...
0
votes
2answers
219 views

linux ls -l 5th column header size units?

after I ran this command in my linux terminal, ls -l I get the information listed in long file format. Below is an example of my output: drwxr-xr-x. 10 10011 10011 4096 Oct 14 18:51 ...
2
votes
1answer
434 views

ls -l but not ls --color=never slow on nfs-mounted directory, if simulatenously writing to that directory

when I dump data into an NFS-mounted directory, reading files modes (e.g. ls -l) is several orders of magnitude slower than a plain file listing (e.g. ls --color=never). I would like to understand ...
42
votes
3answers
29k views

How to have Linux ls command show second in time stamp

Something annoying about ls -l command is it shows only hour and minute for a file(like 08:30). How can I see the second portion(like 08:30:44)? man 1 ls and search for 'second' does not give any ...
8
votes
6answers
27k views

how to list all files and directories in given directory with full path but not recursive?

Somehow like dir /b command but I need also hidden and system files there. Built in dir command doesn't allow to list such 'hidden' files with the rest and I must use /s to have full path in there, ...
1
vote
2answers
164 views

Is it possible to move last modified files using ls, tail and mv?

I want to move the last 3 modified files from a directory using bash commands. However, I noticed that I can use find in the following way: find . -type f -mtime -0.5 -print -exec mv {} ...
3
votes
2answers
543 views

How to make ls command not show Icon? files?

I have a folder (say, Downloads) with a custom icon. When I execute cd Downloads and then ls, it displays Icon? Subfolder1 Subfolder2 How can I make the ls command skip (thus not showing) ...
30
votes
7answers
34k views

ls -d is not displaying directories. Is there a way to get ls to only display directories instead of files and directories

Is there a way to get ls to only display directories instead of files and directories From the man page. -d, --directory list directory entries instead of contents, and do not ...
4
votes
6answers
4k views

Listing everything else than *{.tex, .aux} by ls

How can you ls everything else the the files *{.tex, .aux}? I run unsuccessfully ls -I".tex"
3
votes
1answer
4k views

How to remove the @ / extended metadata of a file?

I know that the @ in -rwxrwxrwx@ 1 me staff 0 16 Mai 10:55 myLog.txt means, that there is some extended metadata attached. Fine. Doesn't interest me. I need to know how to remove it ? I ...
1
vote
1answer
105 views

Bash - list files within date range

So far I've been basing my efforts around this blog and have come up with: startdate=”201407010000? enddate=”201408010000? touch -t $startdate ./startdatefiles touch -t $enddate ./enddatefiles find ...
0
votes
1answer
120 views

Email file and folder list with size?

I am trying to get a list of all files and folders with there sizes (upto 1st level, i.e. file and folder names with there sizes in current directory) emailed to me via an python script. I got the ...
2
votes
2answers
868 views

In linux, how do you get a total size of a folder for files that are 1MB and up

Hi im doing some cleaning up on my server and i want to know how would i get the total size of a folder of files that are 1mb and up and also 1mb and below. I got as far as: ls -lh | grep 'M ' But ...
0
votes
1answer
45 views

If the permissions on a file were set so that everyone could read from or write to the file, how would that be represented symbolically

If the permissions on a file were set so that everyone could read from or write to the file, how would that be represented symbolically (within the output of an 'ls -l' command)?
1
vote
2answers
410 views

Why doesn't ls -lh show the total size of all the files and directories in each directory?

For example, it shows the kernel as being 18M but the Applications folder as being 3.8K BSD/Darwin