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

learn more… | top users | synonyms

5
votes
1answer
339 views

Linux shows several folders with the exact same name

I recently used a mac to copy several files and folders to a USB drive (ext4 through ExtFS), and now in Linux (Xbian) two folders in the root of the drive are shown four times. The output of "ls ...
10
votes
8answers
20k views

Tell `ls` to print only the base filename

This is the default behaviour of ls ls /net/nas/data/languages/pypm/sites/rex/free/2.6/*/pool/v/vi/virtual*1.4.4*pypm ...
0
votes
1answer
87 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
1answer
15 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 ...
1
vote
2answers
41 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 ...
34
votes
9answers
22k 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.
0
votes
2answers
77 views

What does the * mean next to a filename in the ouput of the command ll? [duplicate]

I have a doubt related the output of ll command. When, in my shell, I execute the ll command I obtain this output: -rwxrwxr-x 1 andrea andrea 104215 ott 15 15:56 atmosfs* Why I have the * next to ...
6
votes
4answers
3k 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 ...
382
votes
7answers
242k views

How can I sort the output of 'ls' by last modified date?

How can I sort the output of ls by last modified date?
20
votes
2answers
9k 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 ...
0
votes
3answers
133 views

Get the last file name in a variable in bash?

In a directory, I have the following files: myfile_v01.txt myfile_v02.txt myfile_v03.txt How to make a bash script that detects the value of the last version and put the filename of this last ...
20
votes
2answers
10k views

How do I interpret the results of the `ls -l` command?

I want to learn about the meaning of values for example first line; drwxr-xr-x 2 ataka root 4096 2008-11-04 16:58 ataka is ataka here the owner of directory ? kioutsovkm@orkide:/users/lnxsrv2/ee$ ...
25
votes
7answers
6k views

What does the @ mean on the output of “ls” on OS X' terminal?

When doing an ls in a directory I get the following output: drwxr-xr-x@ 12 xonic staff 408 22 Jun 19:00 . drwxr-xr-x 9 xonic staff 306 22 Jun 19:42 .. -rwxrwxrwx@ 1 xonic staff 6148 25 ...
0
votes
1answer
25 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 ...
40
votes
6answers
45k 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
1k views

How come the ls command prints in multiple columns on tty but only one column everywhere else?

Even after using Unix-like OSes for a couple years, this behaviour still baffles me. When I use the ls command in a directory that has lots of files, the output is usually nicely formatted into ...
0
votes
1answer
65 views

Colorize ls-output by filetype [duplicate]

Every once in a while I have to list some files (~20-50) in Bash on Linux || Mac. These files are from four different file types. ls nand2tetris/myChips/ And16.**hdl** And16.**cmp** ...
0
votes
2answers
56 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
2answers
25 views

Change to xth directory terminal

Is there a way in a unix shell (specifically Ubuntu) to change directory into the xth directory that was printed from the ls command? I know you can sort a directory in multiple ways, but using the ...
3
votes
2answers
263 views

Always run a command after another command

With zsh (and oh-my-zsh), is it possible to always run a command after a certain other command? I want to always run an ls after cding to a directory, rather than running cd example; ls every time. I ...
0
votes
1answer
133 views

cd and ls wont work in terminal mac.

Can anybody explain what is wrong with my terminal: $ echo $PATH =/usr/local/bin $ ls -bash: ls: command not found $ cd -bash: find: command not found Why won't these commands work? Help? ...
2
votes
3answers
1k views

How do I `cd` and then* `ls` automatically in linux?

I have found myself keep doing cd some_dir quickly followed by ls for quite some time now, and have been trying to write a bash alias to let me do this, such as: alas cd="cd $@; ls"; Problem with ...
2
votes
4answers
1k views

Alternatives to cd/ls for command line navigation?

I generally work a fair amount from the command line in order to launch vim, git, ssh and so on. However, I find the Finder's columnar view more natural for browsing through my files. Unfortunately, ...
0
votes
1answer
20 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
43 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: ...
3
votes
3answers
858 views

Is there a tool on Unix, Linux, Mac, Windows, Ubuntu, that will list file / directory structure?

I wonder if there is a tool that will list file / directory (i.e. take a snapshot of the folder and file structure) like the following: audio mp3 song1.mp3 some other song.mp3 audio books ...
4
votes
1answer
51 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
102 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
54 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
95 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
32 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 ...
1
vote
2answers
150 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 ...
1
vote
1answer
1k views

How to use wildcards with ls without listing directory contents?

ls typically displays only the files and folders in the present directory. But once you add a wildcard it starts searching in sub-directories. example: $ ls fight_folder file1 file2 $ ls ...
2
votes
2answers
70 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 ...
1
vote
1answer
57 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 ...
3
votes
5answers
3k 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"
5
votes
2answers
721 views

ls version number sorting Mac OS X

Is there an equivalent to ls -v in Mac OS X that will do version number sorting? In Mac OS X, ls -v does NOT do version number sorting, but the Finder seems to.
0
votes
2answers
112 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 ...
2
votes
2answers
137 views

Where does the “l” command come from on my system?

My Ubuntu allows the use of l as a command to print out the current directory much like ls except that it is actually better in that it specifies which are folders, files, and executables. Is this an ...
6
votes
2answers
159 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
96 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 ...
23
votes
0answers
20k views

ls -la symbolics… what does that last symbol mean?

Possible Duplicate: what does the @ mean on the output of ls on os x terminal? when I type ls -la I get this familiar output... drwxr-xr-x+ 38 kent staff 1292 Nov 6 11:09 . ...
0
votes
0answers
29 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, ...
6
votes
5answers
16k 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, ...
2
votes
3answers
70 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
2k 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
37 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 ...
1
vote
1answer
88 views

Find the largest file in directory without size in output

I need to find the biggest file Only one file should be listed Search should work in given directory and subdirectories Output should display absolute path to the file with filename find "$PARAM" ...
2
votes
3answers
3k views

How to recursively list all files with timestamps and full path?

I want to recursively list all files in a given directory, with their full path and their timestamps. Something like this: 10:30 Dec 10 2010 /tmp/mydir/myfile I've tried with: find . -type f -exec ...