The ls command lists the contents of a directory.
13
votes
2answers
7k views
How do I do a ls and then sort the results by date created?
In what order are the dated ordered by? Certainly not alphanumeric order.
ls -lt sorts by modification time. But I need creation time.
0
votes
3answers
3k views
How to copy files from linux to windows using winscp from a folder which contains millions of files
I need to copy files from a linux machine to a windows machine where the only ports which can be open are for SSH (22).
I can connect to the linux machine using WinSCP but the problem is once I try to ...
2
votes
2answers
453 views
ZSH: `ls *(.)` lists regular files only but `ls *(/)` does not list directories only
I'm not sure I am using ZSH's globbing correctly, but I thought ls *(/) would just list the dirctories under pwd, but it doesn't, it recursively lists all files under every directory under pwd (I got ...
7
votes
3answers
905 views
Why is sorting files by access time not working?
I tried to use command
ls --time=atime
it was working in one directory but wasn't working in another directory.
I opened certain files in vim, evince and other applications but after the
command file ...
0
votes
2answers
2k views
Human-readable ls output under AIX?
How can I get human-readable ls output under AIX? There is no -h parameter
2
votes
1answer
747 views
Enable line breaks when assigning multi line outputs to var in bash
I'm using the following very basic shell script I copied off the net to list the contents of my database backup folder and mail them regularily:
MYSQLLIST=$(ls -lhG /var/backups/mysql/daily/)
...
1
vote
1answer
305 views
How can I make ls show information about the directory specified only, not info about its sub-files or folder contents?
Say I have folder "foo" residing, the home directory. I want to get some info of it, owner, group, permissions, etc...
I then do this to try to get the information:
cd ~
ls -l foo
Of course it now ...
4
votes
2answers
373 views
Tell if a folder/file is hidden in Mac OS X
I know you can set or unset the hidden flag of a folder/file by doing chflags hidden foo.txt and chflags nohidden foo.txt.
But is there anyway of telling whether the folder/file is currently hidden ...
4
votes
2answers
1k views
How to list ALL directories according to their size? [without including the parent directory]
I have a bunch of random folders, some of them are hidden (beginning with a period). I want to list all of them, sorted by their sizes.
I have something on the lines of this in mind:
ls -d -1 -a */ ...
6
votes
1answer
369 views
Using dircolors, how do I change the color of my subversion folders
Below is a sample of my dircolors file, I want subversion folders (.svn) to be colored, but i guess the extension section only applies to file names.
How do i set colors for directories with ...
4
votes
4answers
765 views
file $(ls /usr/bin/* | grep zip) command gives me errors. What's wrong?
I'm a total noob when it comes to unix/linux commands and I decided to read a book.
I've reached a chapter where they try to explain how to pass the output of commands as expansions to the shell.
...
2
votes
2answers
156 views
Move one file at a time based from specific number in the files
Based from this question, The HTML files date format has been changed. All of the HTML files have the date such like below:
20110730dateishere
dateishere is intentionally added by me in the files, ...
1
vote
3answers
471 views
Ls with spaces + variables
I want to do something like this, but it doesn't save the variable after the piping ends:
fs=( )
echo ${fs[@]}
ls -A1 |
while read f
do
echo ${fs[@]}
fs+=( "$f" )
echo ${fs[@]}
done
echo ...
6
votes
1answer
6k views
Bash: assign ls | grep to a variable and echo it with a string
I want to assign the result of an expression to a variable and concatenate it with a string, then echo it. Here's what I've got:
#!/bin/bash
cd ~/Desktop;
thefile= ls -t -U | grep -m 1 "Screen Shot";
...
8
votes
4answers
11k views
How to list files without directories, and filter by name (ls options)
I have a directory called uploads. It contains a bunch of files, plus a few subdirectories which in turn contain files.
Is there a way I can (in one step) do the following:
List ONLY the files in ...
2
votes
1answer
1k views
Why can't list file/directory relative to .. from a symbolic link directory (No such file or directory)?
I have a /usr/tomcat6/logs directory linked to /var/log/tomcat6.
When I changed directory to /usr/tomcat6/logs and try to ls files using a relative pathname ../conf/Catalina/localhost, a No such file ...
7
votes
2answers
226 views
Is there a correct way to list the subdirectories of the current directory?
I can find the subdirectories of a directory by
ls -d -- */
or
ls -l | grep "^d"
but both of these seem indirect, and I would imagine that there would be a standard way to find just the ...
4
votes
1answer
810 views
ls: how do I list directories sorted by timestamps of the files it contains
How do I list directories by their access time in the sense that some new files/directories are created (say, directories containing the most recently created files).
3
votes
1answer
722 views
ls -a not showing folder “system”, but echo * shows it
When I create a folder named system in my home folder, or in /tmp (can't try other locations as I am not root, but owner confirmed same problem even on root), ls -a will not show it. Also tried ...
5
votes
4answers
947 views
What is the “directory order” of files in a directory (used by `ls -U`)?
According to the man page for ls, ls -U means:
do not sort; list entries in directory order.
What does "directory order" mean, and how is it determined?
The following test (executed on an ...
8
votes
6answers
2k views
What does the “number” in the owner field of files signify in linux?
I copied many files to my new linux host. I see that all files have the owner and group both set to 515. What does that mean?
23
votes
1answer
1k views
Why does “ls *” take so much longer than “ls”?
I have a couple of files in a directory:
$ ls | wc -l
9376
Can anybody explain why there is such a huge time difference in using ls * and ls?
$ time ls > /dev/null
real 0m0.118s
user ...
6
votes
3answers
1k views
How do i open all files that are the result of a ls command?
I'd like to open all text files that are the result of a ls command using a text editor. How do i do this?
3
votes
2answers
364 views
Total in `ls -l`
When I run ls -l, the following is displayed:
>: ls -l
total 320
-rw-r--r-- 1 foo staff 633 5 Apr 13:23 A.class
-rw-r--r-- 1 foo staff 296 5 Apr 13:24 A.java
...
What does the ...
14
votes
9answers
2k views
Linux - command to list files (except ls)
Imagine you were working on a system
and someone accidentally deleted the
ls command (/bin/ls). How could
you get a list of the files in the
current directory? Try it.
I tried many ...
4
votes
2answers
5k views
Why is Debian's root shell colorless?
Are there any security concerns? What is the best way to enable it?
2
votes
3answers
927 views
Really strange FAT32 file listing problem
I'm mounting a FAT32 drive on my NAS (which has a USB port), and hitting a strange issue when I use the ls command on the drive root:
ls: cannot access ???²é?u.g: Input/output error
ls: cannot ...
15
votes
2answers
3k views
Output from ls has newlines but displays on a single line. Why?
I think I may be overlooking a relatively fundamental point regarding shell. Output from the ls command by default separates output with newlines, but the shell displays the output on a single line.
...
9
votes
1answer
28k views
How to get only files created after a date with ls?
With ls command, does it possible to show only file created after a date, hour...
I'm asking it because I have a directory with thousand of files.
I want files created since yesterday.
I use ls ...
5
votes
5answers
2k views
Compare files that are in directory 1 but not directory 2?
I'm having trouble with a bash script I want to make
I know ls will list files that are in a directory but I want it to list directories that are in directory1 but NOT in directory2, and then list ...
4
votes
4answers
2k views
last time file opened
Is it possible to get the time when file was opened last time and sort all files in a directory by those times?
8
votes
3answers
4k views
Find the owner of a directory or file, but only return that and nothing else
I am looking for a command that will return the owner of a directory and only that--such as a regex parsing the ls -lat command or something similar? I want to use the result in another script.
3
votes
1answer
174 views
ls pagination on MontaVista with BusyBox
I'm logged into an IP Phone running MontaVista with a very stripped down BusyBox binary (by stripped down, I mean the OEM has removed almost all of its functionality, except the basics like cat, ls ...
9
votes
3answers
4k views
What is the Linux equivalent of DOS “dir /s /b filename”?
List all files/dirs in or below the current directory that match 'filename'.
4
votes
2answers
1k views
Scrolling through ls output without a mouse
In some directories there are quite a few files. When I use ls the output is more than my terminal can handle. Typically I just use one of the following:
ls | less
ls | more
depending on my mood. ...
1
vote
2answers
209 views
Is it possible to change the spacing between files using ls
I'm fairly new to unix and I was wondering if there's some attribute of ls that I can use to change the spacing between the files. Currently I've aliased my ls to output ls -G, so that I have colored ...
4
votes
2answers
488 views
How can I search for a file with fixed name length using ls?
In a directory, I have files like
lazer_100506
lazer_100707
lazer_091211
lazer_110103
lazer_100406_temp
lazer_100622#delete
etc
How can I get a listing of only the first four files?
$ ls ...
4
votes
1answer
257 views
Set ls color listings based on regex instead of globbing
Is it possible to set regex patterns for color matching in the LS_COLORS variable? So instead of just
*.jpg=38;5;220
Can I do
\.(jpg|gif)=38;5;220
That's just an example, I'd like to get more ...
8
votes
5answers
2k views
What is the difference between ls and l?
I accidentally typed l instead of ls today and found that the command still printed a list of the files in my current directory. Trying l --help brings up the help file for ls suggesting that l is ...
13
votes
2answers
2k views
ls command: what does the first line mean?
I haven't been able to find this through internet, 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 ...
4
votes
3answers
2k views
list full path of file without tying it from relative relative path
I could do this
root@server [/home/user/public_html]# ls /home/user/public_html/.htaccess
but I'd like to do this
ls --switch .htaccess
/home/user/public_html/.htaccess
is it possible?
2
votes
1answer
845 views
Find the disk-space usage of a directory and all it's files [duplicate]
Possible Duplicate:
How to know the size of a directory?
If I run
ls -lh
then any given directory is just shown as 4.0K. How can I can make it consider the files the directory refers to ...
1
vote
0answers
134 views
How can I list only the directories present in a directory using ls? [duplicate]
Possible Duplicate:
Is there any option with 'ls' command that I see only the directories?
I have a directory with a lot of files but only a few directories.
To get a list of only ...
2
votes
1answer
754 views
LS_COLORS settings for specific types of files
I'm trying to set up my color scheme for ls, and I'm having trouble finding information about exactly what parameters I have to work with, or where those come from. And especially setting colors for ...
4
votes
2answers
1k views
ls'ing through an entire directory tree to produce one pipeable list of files
This might have been answered already. But I wasn't able to find it.
I have:
directory
directory/subdirectory/subdirectoryofsubdirectory
...
2
votes
1answer
2k views
+ or @ mark after running 'ls -al'
In Mac OS X, run 'ls -al' gives me something like this.
drwxrwxrwx+ 4 smcho staff 136 May 5 09:18 Public
drwxr-xr-x+ 6 smcho staff 204 Feb 1 2010 Sites
drwxrwxrwx 9 smcho staff ...
21
votes
5answers
2k views
Is there any option with 'ls' command that I see only the directories?
Sometimes, I need to check only the directories not files. Is there any option with the command ls? Or is there any utility for doing that?
EDIT: I'm using Mac OS X, and ls -d gives me . even though ...
6
votes
1answer
284 views
How do I get a long listing for a single directory?
I want to see a long listing for a single directory. When I type ls -lha, I see this:
drwxrwxr-x 4 username groupname 4.0K 2010-08-05 09:55 files
drwxrwxr-x 7 username groupname 4.0K 2010-08-05 ...
19
votes
3answers
980 views
What does size of a directory mean in output of 'ls -l' command?
What does size of a directory mean in output of ls -l command?
18
votes
6answers
3k views
what does the @ mean in ls -l?
I am using Mac OSX. When I type ls -l I see something like
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 ...
