The ls command lists the contents of a directory.
2
votes
2answers
56 views
Linux listing files between two date without touch command
I need a command which will list the files between given date and time (YYYYMMDDHHMMSS - format) in to a text file.
I don want to use touch command as its creating permission issue.
I am new to this ...
3
votes
3answers
82 views
How can I display octal notation of permissions with ls - and can octal represent all permissions? [duplicate]
After looking at the man page for ls on my system and searching Google, I see there IS a hack of way to use awk or perl to show octal permissions when using ls, but with bash is there anything more ...
3
votes
1answer
42 views
Why aren't CD image files listed when mounted in current directory?
When mounting a disk image in the current directory using :
sudo mount -o loop -t iso9660 wall.iso ./
Listing files in current directory only returns wall.iso .
To view the actual files on the disk ...
3
votes
1answer
68 views
ACL, ls, “permission denied” and a lot of questionmarks
I have two users, Alice and Bob. Bob should be allowed to list, ls, Alice's home directory. Alice also has a file in her home directory that Bob should also be allowed to read.
I run these commands ...
2
votes
1answer
87 views
cd and ls in the same call [duplicate]
I often have to cd to a directory and ls to see the directory listing. Can it be done with one shot, so that I can add to .bashrc as alias. I searched on Google, there were some answers, but ...
21
votes
7answers
2k views
why does ls -d also list files, and where is it documented?
when specifying ls --directory a* it should list only directories starting with a*
BUT it lists files AND directories starting with a
Questions:
where might I find some documentation on this, ...
3
votes
3answers
148 views
Something's special about /dev/fd/3
I've been trying to learn about file descriptors. When I type "ls -l /dev/fd/" I get
lrwx------ 1 me users 64 May 2 16:02 0 -> /dev/pts/5
l-wx------ 1 me users 64 May 2 16:02 1 -> ...
4
votes
4answers
68 views
linux + how to ignore (filter) file with space
Sometimes a file name is created from a couple of names and space between each name as the following:
$ touch "A B C"
$ ls
A B C <-- one file but has three words ! ...
7
votes
2answers
250 views
List all files with the same inode number?
Lets say, when I do ls -li inside a directory, I get this:
12353538 -rw-r--r-- 6 me me 1650 2013-01-10 16:33 fun.txt
As the output shows, the file fun.txt has 6 hard links; and the inode number is ...
2
votes
6answers
133 views
sort ls output by users
On Linux, is there a way to sort ls output by users? What I try to achieve is something like this:
user_a file1
user_a file2
user_b another_file
user_c this_file
user_c ...
1
vote
1answer
57 views
ls -ld /dir, Solaris [duplicate]
Always when I run ls -ld /dir the output give me the size = 512 even if there are files in it or not.
but when I run du -sh the output give me the actual size of the directory including its content.
3
votes
1answer
117 views
Pass colors from ls through pipe to awk 'print' statement
This is a follow-up to my question from yesterday, Show sum of file sizes in directory listing.
Thanks to Zero Piraeus and a point in the right direction by Mauritz Hansen, I now have
function ...
5
votes
4answers
137 views
Show sum of file sizes in directory listing
The Windows dir directory listing command has a line at the end showing the total amount of space taken up by the files listed. For example, dir *.exe shows all the .exe files in the current ...
2
votes
2answers
71 views
Can I `ls` all files in a directory from “1”, “2”,…,“9”, “10”, “11”, …, “20”, “21”, …?
I have a directory with files named "1", "2",...,"9", "10", "11", ..., "20", "21", ... inside.
Can I list them in the order of "1", "2",...,"9", "10", "11", ..., "20", "21", ...?
I have tried ls ...
2
votes
1answer
24 views
Which option of ls should be used for understanding metadata changes?
How can one find the latest time of metadata changes to a file?
Let's say I changed the ownership of a file and then I did ls -l. It still shows the latest file changes. But I want to see the time ...
0
votes
1answer
56 views
What is the @ after directory listing mean? [duplicate]
so I have some files in a directory and when I type ls -l I get
-rw-r--r-- 1 home staff 275 Apr 9 16:01 index.js
-rwxr-xr-x@ 1 home staff 2565 Apr 8 10:38 person.js
-rwxr-xr-x@ 1 home ...
1
vote
4answers
153 views
Is there a command to list files, exclude sub-directories and display size and date?
Before I begin please assume I have only basic knowledge in UNIX. Basic meaning I have only started reading about it since last week for a work related purpose.
I have been experimenting with the ls ...
3
votes
1answer
60 views
Listing both ls information and mount points of a directory?
On my Ubuntu Natty, typically all new drives inserted (e.g. USB Flash thumbdrives) are mounted under /media. So, on my system, I can do something like this:
$ mount | grep '/media'
/dev/sda6 on ...
1
vote
7answers
185 views
Convert ls -l output format to chmod format
Say I have the following output from ls -l:
drwxr-xr-x 2 root root 4096 Apr 7 17:21 foo
How can I automatically convert this to the format used by chmod?
For example:
$ echo drwxr-xr-x | ...
1
vote
1answer
77 views
What is a sure fire way to find all files and/or path that contains 2 keywords?
I was doing a
find . -iname '*sitesearch*' | grep demo
because I know the file should be some/path/SiteSearch/demo/SiteSearch.html, but it turned out a person put the file in as ...
0
votes
1answer
86 views
Must parse ls -Al output and get file or directory name [duplicate]
I must parse ls -Al output and get file or directory name
ls -Al output :
drwxr-xr-x 12 s162103 studs 12 march 28 2012 personal domain
drwxr-xr-x 2 s162103 studs 3 march 28 ...
0
votes
3answers
85 views
output only file names(with spaces) in ls -Al
I should echo only names of files or directories with this construction:
ls -Al | while read string
do
...
done
ls -Al output :
drwxr-xr-x 12 s162103 studs 12 march 28 12:49 personal ...
1
vote
1answer
43 views
mark or color empty directories for `ls`
ls's -F flag allows to see the types of file and distinguish directories. Is there a way to add a functionality to distinguish an empty directory?
2
votes
2answers
91 views
Working of rm/ls with [0-9]
I am learning the shell commands and came across the short tags eg.[0-9],[[:digit:]] etc.. As a proof of concept i tried deleting all the files with the rm command(i know its not a good practise but i ...
1
vote
1answer
72 views
starting vim with command substitution
I am working on a project on two different machines - one running Mac OSX 10.8.3, and one running Red Hat Enterprise Linux. On my Mac, I can do this:
vim $(ls -R */*.@(h|cpp) */*/*.@(h|cpp))
and ...
2
votes
4answers
100 views
Find directories that do not contain subdirectories
I'm writing script is ksh. Need to find all directory names directly under the current directory which contain only files, not subdirectories.
I know that I could use ls -alR and recursively parse ...
3
votes
2answers
120 views
Why do . and .. have a file size of 4 kB and 12 kB, respectively? [duplicate]
As displayed by ls -al, for example:
drwxr-xr-x 9 jb jb 4.0K Mar 8 18:05 ./
drwx------ 49 jb jb 12K Mar 17 14:15 ../
I assume this is the minimum amount of space required to store the inode's ...
5
votes
4answers
332 views
Shell command to get all the files from a complex directory structure
I'm looking for a shell command in order to get all the files in a complex directory structure. By complex directory structure I mean that there's a root folder with more than 150 subfolders and for ...
1
vote
1answer
226 views
`ls` command does not list latest directory contents
The Linux shell does not print up-to-date information when it comes to ls. For example I use my other processes (IDEs etc) to create some directories. However when I run an ls command I don't see ...
1
vote
1answer
50 views
Total vs listed directories [duplicate]
On a server when I type in ls -al I get a list of the directories
-bash-3.2$ ls -al
total 12
drwxr-xr-x 3 root root 0 Feb 13 2011 .
drwxr-xr-x 4 root root 4096 May 11 2011 ..
drwxr-xr-x 55 ...
3
votes
2answers
94 views
customise ls color for directories contain specified file/s
How can I colorize directories contain files with word INCORRECT inside?
Example:
I have 3 directories which contain log file.
dir_a/log
dir_b/log
dir_c/log
The file log in dir_c contain word ...
1
vote
2answers
166 views
Ignore all matches to negated extglob pattern in recursive ls
I would like to recursively list all files in a directory which match a given input pattern using ls. (Oh, and this is in Bash).
The only way I can think of to do this using ls is to shopt -s extglob ...
2
votes
2answers
387 views
list all files newer than given timestamp and sort them
I want to list all files (sorted by date) that are newer than timestamp in format 20130207003851 in directory /tmp only. Subdirectories can be omitted.
Using SUSE Linux Enterprise Server 11.
The ...
3
votes
0answers
217 views
ls and vim color on SunOS 5.8/Solaris 8
I want to use ls and vim with color on Sunos 5.8
SunOS 5.8 Generic_117350-11 sun4u sparc SUNW,Sun-Blade-2500
I have installed ls (GNU coreutils) 6.9 and vim 7.2
In ~/.cshrc:
setenv TERM sun-color ...
3
votes
2answers
191 views
Get the complement of the result of an ls command
Let's say I have a directory with multiple files, all of which are either binary files (files with no declared extensions) and source files (.c extension). I do this:
$ ls
and get:
README.md ...
2
votes
1answer
232 views
How does wc -l `ls` give the actual number of lines?
Can anyone explain to me how does this command work.
wc -l `ls`
while this command gives the total number of java lines or txt lines.
4
votes
2answers
1k views
How do I make `ls` show file sizes in megabytes?
What commands do I need for Linux's ls to show the file size in MB?
4
votes
2answers
196 views
Number of lines outputted by ls
When ls is called, it outputs all the files/directories in the current directory, attempting to fit as many as possible on each line. Why is it that when passed to wc -l, it outputs the number of ...
2
votes
1answer
59 views
Local, regular file causes `stat` or `ls -l` to hang
I've seen a few different questions about ls hanging. It's usually because they use the -l switch, which causes a stat on the file, which in turn is a bad symlink or pointing to an NFS mount or some ...
27
votes
5answers
2k views
The result of ls * , ls ** and ls ***
I know using the command ls will list all the directories. But what does the ls * command do ? I used it and it just lists the directories. Is the star in front of ls means how deep it can list the ...
0
votes
1answer
78 views
How to display directory permission without listing permission for their contents [duplicate]
Possible Duplicate:
How can I make ls show information about the directory specified only, not info about its sub-files or folder contents?
I am new to UNIX and I want to display the ...
1
vote
1answer
183 views
Please explain the output of the ls -all command
This is one of the many similar lines from the output from ls -all
lrwxrwxrwx 1 subhrcho dba 25 Dec 6 01:36 beam-server.jpr -> .ade_path/beam-server.jpr
What does the above signify ? I am ...
3
votes
4answers
370 views
List all files / binaries in current PATH
Is there an "easy" way of running an "ls -la" style command for listing all files / executable binaries in the current PATH?
(I intend to pipe the output into grep, for looking for commands with ...
3
votes
5answers
160 views
Print non-existent files from a pipe input
I have a directory of lots of .PDF and .JPG files.
There should be a .JPG file for each .PDF with the same name.
I'm trying to use a command to find .PDF files that doesn't have a .JPG file.
My ...
4
votes
2answers
178 views
how to use grep for specific files?
for example I type
ls -altr | grep "23 Dec"
so it will show files for 23 Dec only and I want to use grep for them, like
ls -altr | grep "23 Dec" | xargs grep -l "some_string"
but this doesn't ...
5
votes
3answers
167 views
What's the best way to list size of / in Terminal?
I want to see how much total space / is taking, but I don't know how to do that. I can use ls -hal and add up the subtotals, or I can use fdisk to tell me the size of that partition, but is there a ...
4
votes
2answers
390 views
What does the 'd' mean in ls -al results and what is that slot called?
In Linux, what does the d mean in the first position of drwxr-xr-x? And what are all of the possible letters that could be there, and what do they mean?
I'm trying to learn more about the Linux file ...
0
votes
1answer
161 views
difficalty to save traceroute output in shell variable?
I need to filter and store traceroute output in shell variable (array). But I am getting some unusual output.
As I try to explain in following lines.
My present directory is temp, having some ...
1
vote
5answers
173 views
Identify folder in bash
I was trying to learn how to identify only folders within a folder on the main level.
example:
main
-folder 1
-folder 2
-folder 3
I started with this script:
#!/bin/bash
...
2
votes
2answers
124 views
Different count for compressed file listing vs directory listing
I was taking a backup of a folder, where I used the following command :
sudo tar -zcvf www.tar.gz /var/www/
It successfully compressed, just for verifying the number of files in the compressed ...

