The ls command lists the contents of a directory.
5
votes
2answers
718 views
Output ls -l size field with digits grouped by thousands?
It is possible to make ls -l output the size field with digits grouped by thousands? If so, how?
For instance:
$ ls -l
-rw-rw---- 1 dahl dahl 43,210,052 2012-01-01 21:52 test.py
(Note the commas ...
1
vote
3answers
203 views
Display a menu of files names and let the user select a file by entering a number
I have created a script that allows the user to select a file by copying and pasting that file. Then perform a grep on that file. I want to know is it possible to put a number in front of each files ...
2
votes
2answers
375 views
How can I stop ls from descending into directories, similar to prune for find?
If I type ls *ro* I also get files in subdirectories that match the *ro* pattern.
Is there any option for ls similar to prune?
Ideally a flag, otherwise perhaps an exec?
3
votes
2answers
782 views
How to solve sudo: unable to execute /bin/ls: Argument list too long
When I run this command from php
sudo -u db2inst1 ls -t /var/lib/edumate/bdrs/*/*/daily/*NODE* | sort -r
I receive sudo: unable to execute /bin/ls: Argument list too long
ls lists all daily backup ...
11
votes
2answers
317 views
What is the number between file permission and owner in ls -l command output?
The output of ls -l command yields the following result:
What is the number field between file permission and owner? i.e. what are those 1, 1, 1, and 2? I checked the --help but that doesn't ...
2
votes
2answers
112 views
What does it mean when the output of $ls -lasrt includes '.' and '..'
I input the command:
$ ls -lasrt
And the output includes (there are more results, these are the ones that confuse me):
4 drwxr-xr-x 5 tuc40953 stdchem 4096 Jul 3 17:48 ..
4 drwxr-xr-x ...
6
votes
3answers
322 views
Bash autocomplete gives different file name than ls
An incredibly strange thing just happened. Through a serious typo, I entered
cp filename.xsl .^?~
Yeah, that's right, dot-caret-questionmark-tilde! Truth is stranger than fiction.
It gets weirder. ...
1
vote
1answer
186 views
wdfs mount problem
I'm running Fedora/Gnome 3.4.2 64bit and I'm trying to mount a webdav file system to work with.
As root, I run the command
#mkdir /mnt/webdav
#wdfs https://www.webiste.com:port/directory ...
4
votes
5answers
811 views
Strange case: Text file that exist and doesn't exist
I'm completely puzzled about a problem with a single plain text file in my system fedora 12. I used a known software in bioinformatics, maker, to produce lots of plain text files and one of them it ...
6
votes
4answers
2k views
How do I make ls sort underscore characters first?
I like being able to name files and directories with an underscore prefix if it's something I want to keep separate from other files and directories at the same level. On Windows and Mac, for example, ...
2
votes
4answers
3k views
Argument list too long for ls
I get the following error when trying to ls *.txt | wc -l a directory that contains many files:
-bash: /bin/ls: Argument list too long
Does the threshold of this "Argument list" dependent on distro ...
2
votes
1answer
1k views
How to get exact file size and file name?
Right now I am using ls -lt /my/directory (see below) then php parses the output. But inconsistently because the delimiter is space and there might be two or more spaces in between two fields.
The ...
1
vote
1answer
435 views
What does @ sign mean in 'ls' output on Mac OSX Lion terminal? [duplicate]
Possible Duplicate:
what does the @ mean in ls -l?
What does the @ sign mean in the following "ls" output?
-rw-r--r--@ 1 root wheel 489 Jan 4 13:14 boot.plist
2
votes
1answer
377 views
ls in glorious 256 colours [closed]
Apart from the ls colors solarized theme, is there any other ls colour themes out there that you would recommend for a dark background with a urxvt terminal?
2
votes
3answers
438 views
Can I list only specific subdirectories?
I have a folder tree structure like
arndell
\_databases
\_daily
\_weekly
claremont
\_databases
\_daily
\_weekly
monte
\_databases
\_daily
\_weekly
and I am only after all files inside ...
9
votes
2answers
1k views
Why does ls sorting ignore non-alphanumeric characters?
When sorting file names, ls ignores characters like -,_. I expected it to use those characters in sorting as well.
An example:
touch a1 a2 a-1 a-2 a_1 a_2 a.1 a.2 a,1 a,2
Now display these files ...
12
votes
1answer
2k views
ls taking long time in small directory
Running Ubuntu, I open a terminal and do
sudo bash
cd /
ls | head -n 1000
And predictably about 20 directories are returned.
However, if I do an ls, and don't pipe it into anything, the ls just ...
3
votes
2answers
669 views
List of Recently Modified Files
How can I Get a list of all files modified , say 3 months ago.
I checked this question but I was not able to apply it to my scenario.
I am trying this now , it seems to be working , but I know there ...
7
votes
6answers
2k views
List files sorted numerically
I have a bunch of files from log1 to log164.
I'm trying to LIST the directory (sorted) in a UNIX terminal but the sort functions are only providing the format like this:
home:logs Home$ ls -1 | sort
...
11
votes
2answers
564 views
“ls -lh” reports total size less than sum of individual sizes
Under what circumstances would ls -lh show a total that is less than the sum of the individual files? For example:
$ ls -lh /var/lib/nova/instances/_base
total 100G
-rw-rw-r-- 1 nova nova ...
1
vote
2answers
404 views
dircolors “missing second token”
I'd like to customize the colors of ls and as far as I understand the way to go is with dircolors.
I did:
dircolors > ~/.dircolors
Immediately after this I launch a terminal and get this error:
...
0
votes
2answers
310 views
ls outputs multiple columns even if piped to grep with grml's zsh config
I just decided to give zsh a go against Bash and came across some unhandy behaviour about which I couldn't find anything on the net:
If you do a ls | grep foo in Bash, the ls only contains one file ...
5
votes
4answers
9k views
How can I list subdirectories recursively?
The obvious
ls -dR
does not work.
I am currently using
find /path/ -type d -ls
but the output is not what I need (plain listing of sub-folders)
Is there a way out?
2
votes
3answers
3k views
ls to show only directory/filename and size
First of all, this is not a duplicate of this: Linux ls to show only filename date and size
Because I want to print actual directory name additionally.
I was always using this command:
ls -l | awk ...
3
votes
2answers
134 views
Is it possible to show the contents of a directory without changing into it?
I'd like to show the contents of a folder without first changing into it. for example:
---- Documents
|
|
L_ Essays
If I'm in Documents, how can I show the contents of ...
7
votes
1answer
479 views
Why isn't the ls command listing huge filesizes?
In my Redhat Linux, I am getting the following error when executing the ls command.
# ls
ls: sugar.sql: Value too large for defined data type
8
votes
2answers
377 views
What is the point of ls -f (or, why is this hanging?)
I've got a directory with about 100,000 files in it. ls -f hangs for over a minute. I ran strace, and immediately started seeing getdents, so ls is clearly reading the directory. I also see a lot ...
3
votes
1answer
2k views
How can I use `find` and sort the results by mtime?
I want to use find but sort the results reverse chronologically as with ls -ltr. Is this possible through any combo of flags or pipelines?
2
votes
2answers
2k views
Want to sort files by update date including sub-directiroies
I want to sort only files by update dates including sub-directories.
I found out ls -lrtR |grep ^-. but it doesn't seem to sort by update dates.
And I need to save this list into a file. Is it ...
2
votes
3answers
2k views
How to search and replace text in all php-files in a directory and it's subdirectories
I am looking for a shell script that recursively traverses all .php files in a directory and performs a search & replace of a particular text pattern.
The search pattern is quite long ( > 5000 ...
3
votes
2answers
1k views
file block size - difference between stat and ls
I've noticed that when I do a:
ls -ls file
It provides block count, say 8 blocks.
When I do:
stat file
I notice that the block count is 16, twice the number given by ls.
The block size on my ...
8
votes
3answers
1k views
How can I use ms-dos style wildcards with ls and mv?
I have the misfortune of coming from a MS-DOS background - but at least it makes me appreciate how much more powerful Linux is. I've been working on getting my Linux-Fu up to par, but there are a ...
2
votes
2answers
1k views
How to change the colour of embedded terminal in linux mint 12 to be able to use `ls` and `byobu`?
I'm using Linux Mint 12 and am having problems with the embedded terminal in gedit.
Using the default themes I'm unable to use 'ls' and 'byobu' as in part of their output foreground and background ...
3
votes
2answers
463 views
What's the difference between “s” and “S” in ls -la?
When I ls -la, it prints many attributes. Something like this:
-rwSrwSr-- 1 www-data www-data 45 2012-01-04 05:17 README
Shamefully, I have to confess I don't know the exact meaning of each ...
3
votes
2answers
122 views
How do I create a structured list of all the files and directories under a particular directory (recursively)?
I need to have an "image" of a file system without actual contents of the files - just all the names and the structure, so that I can read the file and know what files were stored there and how were ...
7
votes
6answers
4k views
What's the best way to count the number of files in a directory?
If parsing the output of ls is dangerous because it can break on some funky characters (spaces, \n, ... ), what's the best way to know the number of files in a directory?
I usualy rely on find to ...
-2
votes
1answer
199 views
Why does this script show all files in the directory and not just PDF files?
I wrote the script below to find the number of PDF files in a given directory. However, it instead shows all the files in the directory:
#!bin/bash
message="."
message1="*.pdf"
ls -al $message ...
3
votes
1answer
243 views
Zsh autocomplete ls command with directories only
Suppose I have following files and directories:
% ls
bui00293 buiawer builds/ buiowpe/
I want to list the content of ...
3
votes
2answers
92 views
Executables show with character * next to their name in output of ls
I noticed that when I list my executables with ls on my Z shell they show up with a character * next to their name (e.g. see the file in red .test_color_scheme)
What is causing ...
6
votes
1answer
316 views
Controlling what files to display
I recently changed my emacs config to hide backup files by prepending a dot to the file name. This got me to thinking - is there a ready way to change the behavior within Bash to use a list of ...
1
vote
1answer
168 views
file missing from Desktop screen but can be seen using “ls” under the Desktop directory
I downloaded some files onto desktop. After typing ls under the Desktop directory, I can see these files. However, I cannot see the icons on my desktop corresponding to the files I see with ls. I use ...
1
vote
1answer
228 views
colorizing ls output based on filename
i'm on freeBSD and trying to colorize ls output, so i've added
alias ls ls -lhG
setenv LSCOLORS gxfxcxdxbxegedabagacad
to my .cshrc
and it works. but what i really want to - is to be able ...
2
votes
3answers
258 views
How universal is the -L (dereference symlink) switch of the 'ls' command?
I have some software that, among other things, needs to:
Assess a file's rwxrwxrwx permissions;
Work under every possible flavor of Unix and Linux you can find in the wild.
Currently, it does that ...
-1
votes
1answer
181 views
How can I tell when a file was modified?
I am running some simulation on a high performance computing cluster (HPC). When I check when the file was changed with ls -t I get the wrong result. I know this becouse I have run a small job that ...
5
votes
4answers
3k views
How to find a file in the filesystem from the command line?
I'm fairly new to Linux, and I've now found myself in a situation where I'd like to find where a file (with a partially-known filename) is in the file system. I'd like to know how to do this from the ...
13
votes
3answers
336 views
When does `ls -s` print “0”
Of course, the standard way of testing if a file is empty is with test -s FILE, but one of our clients have received a script containing tests like this:
RETVAL=`ls -s ./log/cr_trig.log | awk '{print ...
2
votes
2answers
344 views
How do I show all files in a directory except those that have a certain extension AND display them in multiple columns?
Since I write in Python a lot it's kind of annoying to see .pyc files all the time and I would like to just hide them at this point. I tried the following, but I can't seem to figure out how to get it ...
5
votes
5answers
5k views
How to report number of files in all subdirectories?
I need to inspect all sub-directories and report how many files (without further recursion) they contain:
directoryName1 numberOfFiles
directoryName2 numberOfFiles
10
votes
5answers
2k views
case-insensitive search of duplicate file-names
I there a way to find all files in a directory with duplicate filenames, regardless of the casing (upper-case and/or lower-case)?
5
votes
2answers
347 views
How to list files and directories with directories first
I have two questions. First, which command lists files and directories, but lists directories first?
Second question: I want to copy a list of files into a single directory, but make the target ...