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

learn more… | top users | synonyms

6
votes
3answers
150 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
14 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 ...
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
55 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.
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 ...
9
votes
3answers
829 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 ...
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 ...
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 ...
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 ...
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
534 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
71 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 ...
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 ...
0
votes
1answer
178 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 ...
1
vote
2answers
240 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, ...
0
votes
2answers
706 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 ...
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
209 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 ...
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 ...
2
votes
1answer
429 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 ...
1
vote
1answer
104 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
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)?
0
votes
1answer
442 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 ...
0
votes
1answer
45 views

How can I get VIM to maintain the creation date for a file? (OS X)

So whenever I save a file in VIM on OS X, it seems to overwrite the entire thing instead of updating it. If I run ls -tU I can see that the creation date changes and it does indeed update to the last ...
1
vote
2answers
161 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 {} ...
0
votes
1answer
40 views

cd into first/second/third directory returned by ls -d */

Say I am in a directory code: /code /very-long-and-descriptive-name If I want to cd into that directory (or a directory if it comes first in alphabetical order), I can just cd *. Now say I add ...
2
votes
2answers
625 views

OS X Terminal wildcard doesn't work for some paths

Okay, this is weird, hopefully someone here can explain what is happening. I am using OS X 10.9.4 and I want to list files in a directory (and filter them using *) I want to look for zip files in ...
0
votes
1answer
28 views

problematic listing of folder with many files

In ubuntu I have a folder that contains many (~10M) .txt files (around 1-2KB each). Folder is not big by itself (around 400MB) and does not contain subfolders, just the .txt files. I need to list it ...
0
votes
1answer
820 views

FTP.exe ls to local Output File Permission Denied on Local Network

I am trying to access a directory on my Filezilla FTP server using the ftp command in Windows from a local computer on the network, and then put a list of all those files in the directory in a text ...
0
votes
2answers
127 views

Whats the meaning of “???” in ls command output

I am using WD my passport hard disk. when i use ll -l command in my hard drive it shows as below ls: cannot access The.Big.Bang.Theory.S07E15.HDTV.x264-LOL.mp4: No such file or directory ls: cannot ...
0
votes
1answer
147 views

SunOS 5.10 - ignore certain files in ls

I don't know why but I can't execute ls with ignore flag: -bash-3.2$ ls -I '*.log' ls: illegal option -- I Do you know what else can I try?
0
votes
2answers
140 views

How to List Files greater than particular timestamp?

I have a directory in linux which has a list of log files where log files get auto generated if some job runs. Each log file gets appended with the timestamp like "JobName_TimeStamp" UPDATED: ...
4
votes
1answer
130 views

Finding the newest file in a directory with a million files

I'm currently using ls -t | head -1 to get the name of the newest file. But it takes a long time because my directory has a million files. I guess a chunk of time is lost unnecessarily in ls -t when ...
0
votes
1answer
836 views

How to create a fixed size virtual disk with qemu-img?

What's the best way to create a fixed size disk with qemu-img ? I tried doing this., and it always seems to be creating a virtual /growing disk, doing a ls returns the actual small size of the vmdk. ...
3
votes
1answer
144 views

Why is `ls` command not permitted in non-root account even using `sudo`?

I logged into Ubuntu with guest session account, but the ls command is not permitted even using sudo. But... why? Any ideas?
0
votes
2answers
583 views

ls to list files sorted by filename without the extension

I want to list a bunch of files that are sorted by their names excluding the file extension. I have these files in a directory $ls mobility_arXiv.tex mobility_SR.bbl paper-hj-mm.tex ...
0
votes
1answer
50 views

Ignoree a specific file in file count “wc -l”

e.g. I have directory like ABC. And this directory contain following files (it contain number of files i just include 4 fils here) 2014-04-29T06-19-20_17368f93ce.mp4.uploaded ...
2
votes
2answers
379 views

How to list only ordinary files on UNIX

I'd like to list only ordinary files (not directories or symlinks) using ls from GNU tools. So far I have only some hackish greps. Is there an option or better way of doing that? Edit: I need more ...
2
votes
1answer
136 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
331 views

ls command - long format field separator

Is there a way to use a different field separator for the long output of ls? I have problems in parsing the output of ls -l because some fields, in my case the group, contain spaces. I went through ...
7
votes
2answers
376 views

What is the modification date ls reports for directories in Bash shell?

When I run ls -l in Bash shell, it lists a modification time for both files and directories. As noted in this thread, the modification time for directories does not reflect all of its contents. It ...
3
votes
1answer
168 views

What causes files to use up more more disk space than the file size suggests?

du was showing some drives with much less space than I was expecting, and ls -alh also showed the sum at the top to be a factor of three more than the sum of the individual files. Following this ...
0
votes
0answers
33 views

What does the at sign mean when listing files with ls? [duplicate]

When copying files with cp command on Mac OSX Mavericks and then looking at them ls command I sometimes see an @ sign in the listing. What does it mean please? For example: # cp -v ...
2
votes
1answer
21 views

Search .zip files for sizes

I have a directory with many .zip files. I wish to search through them to match an uncompressed file size (I am trying to find which .zip my file originated in, and the name's been changed). IDEALLY, ...
2
votes
3answers
192 views

Linux - Open nth File LIsted

I'm Ubuntu, I do ls and get a list of files. How would I open the nth file in the list in VIM in reference to its position from the ls command, and not its name? I want to do this cause a directory ...
1
vote
3answers
6k views

Ls command in bash script says 'No such file or directory'

The following is the script I am running #$1 - Argument declare IPATH="sample/" declare F=$IPATH$1 echo $F ls $F The input is ./script.sh "Fil*" The echo output is - sample/Fil* when I run the ...
0
votes
1answer
56 views

Supressing backup files in a ls command not working

How do I suppress backup files displayed in ls? I've already tried - ls --ignore-backup and ls -B Neither suppress the back-up files created by the editors. Am I doing something wrong? or Is there ...