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

learn more… | top users | synonyms

0
votes
2answers
40 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
3k 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
244 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
22 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 ...
5
votes
1answer
157 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 ...
-1
votes
2answers
21 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
57 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 ...
23
votes
3answers
14k 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 ...
6
votes
6answers
20k 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, ...
38
votes
10answers
25k 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.
1
vote
2answers
51 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
407 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) ...
1
vote
1answer
83 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 ...
25
votes
7answers
21k 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
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"
2
votes
1answer
3k 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
51 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
115 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
679 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
27 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
382 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
0
votes
1answer
1k views

Total folder size with ls -lh

I created a directory where I put ten files, each one with exactly 1,048,576 characters (1024^2). The size of each one of them should be exactly one megabyte, counting megabyte as 1024^2 bytes. If I ...
2
votes
1answer
572 views

Changing the order of columns displayed with `ls`

Is it possible to change the order of displayed columns when running ls -l on *nix (or dir on Windows)? For example, I'd like to see the date modified, then the name, then other fields (or select ...
2
votes
2answers
9k views

Unix - List all directories and subdirectories, excluding directories without files

I would like to list all the directories and sub directories in and below the current path. Since I only wanted to display directories I came up with the follwing command: find -type d -exec ls -d1 ...
1
vote
2answers
172 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
43 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
24 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 ...
4
votes
2answers
2k views

How to physically reorder files `03.mp3 01.mp3 02.mp3` (`ls -f`) in a directory?

The physical order of the files matters when I copy them onto my USB stick and listen in car mp3 player. Most of my music album folders are unsorted, e.g. ls -f may produce: 03.song3.mp3 01.song1.mp3 ...
0
votes
1answer
146 views

“File” exists or not

ls -il ls: cannot access éaj/p╬σt.ó∙e: No such file or directory ls: cannot access éaj/p╬σt.ó∙e: No such file or directory ls: cannot access é@j/p╠φt.│∙N: No such file or directory ls: cannot access ...
0
votes
4answers
691 views

Using the ls -l with a pipe how can i get it to display the 8th file in the list without the file details

I am looking to display the 8th file name in a directory using ls -l and pipe for example ls -l | wc -1 would give me the count but what i want to have returned is the 8th file name in the directory ...
0
votes
1answer
1k views

Compare content of directories in Linux

In Linux, if I have two directories, how I can see the differences of content in these directories? Now I use this command: diff <(ls -d dir1/*) <(ls -d dir2/*) Any other idea?
6
votes
2answers
761 views

Is there a tail -f equivalent for ls?

Basically the question is in the title. I want to monitor a directory for new files that are written or deleted, the way I can monitor a log file with tail -f. Is this possible?
1
vote
2answers
794 views

How do I recursively list the contents of all files in a repository (extension-agnostic) into a single text file?

I know that using "ls -R ." in bash you can recursively list the filenames. Can I use some similar command to list the contents of each file just the way their names are displayed using the ls ...
5
votes
1answer
405 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 ...
12
votes
8answers
23k 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
400 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
27 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 ...
0
votes
2answers
91 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 ...
7
votes
4answers
4k 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 ...
445
votes
7answers
286k 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?
0
votes
3answers
384 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 ...
21
votes
2answers
11k 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$ ...
30
votes
7answers
10k 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
27 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 ...
41
votes
6answers
51k 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
2k 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
71 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
75 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
27 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
375 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 ...