Questions relating to the Linux 'list' command (ls)
1
vote
1answer
29 views
listing files in a directory without listing subdirectories and their contents in that directory
I want to create a list of all the files in a directory, without listing any of the subdirectories that reside in that same directory, and print that list to a new file.
ls -d * > filelist
will create ...
4
votes
1answer
74 views
Nautilus sort order with ls
I am creating image sprites and have neatly named around 100 files. I am using the following to generate an image sprite from individual images:
convert $(ls -w 1000) +append sprite.png
I have just ...
0
votes
1answer
24 views
Using alias to change ls to ls-l changes(or disables) the colors of ls output
I've used alias to change ls to ls -l, but the colours change to the normal font of the terminal (also tried ls -l before the alias command and the colours appeared fine).
What is wrong?
Thank you
4
votes
3answers
100 views
Can ls -l be made to separate fields with tabs rather than spaces to make the output useful in a spreadsheet?
How can the output of ls -l be modified to separate fields using tabs instead of spaces? I want to paste the output into a spreadsheet; the padding with a variable number of spaces makes it difficult ...
2
votes
2answers
54 views
How can I list the files in other (non-current) directory?
If ls lists the content of the current directory, is there a similar command that list the content of a non current directory, without using cd?
24
votes
2answers
670 views
Why does ls -l output a different size from ls -s?
I can't figure out why I'm getting the following results:
ls -l tells me the size of a given file (HISTORY) is "581944":
$ ls -l HISTORY
-rw-rw-r-- 1 waldir waldir 581944 Feb 22 10:59 HISTORY
ls ...
0
votes
0answers
41 views
Unable to execute run command in terminal; run: command not found
i tried to run the following command as user1@server1.com:-
run "server_name" 'ls -lt /home/nextag/live' and it gave the following error:- -bash: run: command not found
server1 is a jump server for ...
0
votes
1answer
31 views
How to make ls produce ISO 8601 format
In older versions of Ubuntu, like 9.10, ls(1) produced ISO 8601 format by default, in the way
ls -l --time-style=long-iso
does it. With 12.04, we're back at the older Unix style. Thus replacing ...
0
votes
0answers
30 views
How check directories that i have rights to copy in terminal?
How check directories that i have rights to copy in terminal?
Sometimes when i do ls -la, i see drwxrwsrwx 4 ownername dirname ... but i tried to do scp -r into my own machine, but i get ...
0
votes
1answer
62 views
Bash command: ls -lah not showing /etc directory?
Ok guys, elementary question.
I was poking around my server, and I noticed that when I 'ls' the / directory, /etc folder is not displayed. Why is that? I can very easily cd into it, but why is it ...
6
votes
2answers
118 views
Colorize hardlinks in ls output?
How can I colorize hardlinks myself? Turns out on an old Ubuntu 10.04 I have, this happens by default (same .bashrc and .profile in use), whereas on the newer Ubuntu 12.04 it doesn't.
This is the ...
9
votes
2answers
235 views
What are = and | in the output of “ls -F”?
I am working on creating a 'cheat sheet' of shell commands. I am currently researching the ls command and its flags. For the -F flag I know what the majority of the appended indicators mean but for; = ...
2
votes
2answers
166 views
How to list text files without a .txt file extension?
For example, how can I replicate
ls *.txt
when my text files are missing the .txt ending, and as far as extensions go appear the same as many other types of file?
Alternatively, is it possible to ...
2
votes
2answers
56 views
use output from alias command as filename to open in vi
I set up an alias this morning to help finding the latest log file in a directory. My alias looks like
alias latest="ls -lat | grep ^- | awk '{print \$8}' | head -1"
In my research so far this ...
1
vote
0answers
86 views
No boot or grub file after using ls command
I had xubuntu installed, i believe version 12.04 and then tried to dual boot with backbox. It worked from the flash drive but upon installing it onto the hard drive, I could no longer boot backbox. I ...
1
vote
3answers
188 views
List files of particular extension
Ok this is strange. I am using this code,
ls *.prj
To list all the files with the .prj extension in the dir but I am getting this error,
bash: /bin/ls: Argument list too long
I eventually ...
8
votes
7answers
3k views
How to move multiple files at once to a specific destination directory?
I got a bunch of files in some directory (along with many other files) that I want to move.
Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep ...
0
votes
1answer
233 views
Creating a new file with touch command actually creates eight unlisted files?
Have a look at this screenshot:
Pardon for my language used when I installed Ubuntu. Anyways, it is beyond my imagination how come creating an empty file actually creates eight files, alas, the ...
0
votes
1answer
86 views
'ls' and file managers hang on home directory after installing KDE
Today I installed KDE on my Ubuntu 12.04 using:
apt-get install kubuntu-desktop
Everything is running fine, apart from one very strange issue: it seems impossible to list the files in my home ...
8
votes
4answers
357 views
What is the significance of the asterisk in the file listing results?
I have noticed that some of my files have an asterisk at end.
Does the asterisk at the end have any particular significance? I think they are mostly executable and displayed in green by the ls ...
3
votes
1answer
132 views
Directory permission
I am running 12.04 x64 server on ext4 disk. There are two user groups 'A' and 'B'. For a specific directory, I would like to give its all permissions to user group 'A'. Also I would like to give only ...
6
votes
2answers
230 views
What does the l command do?
There is a command l available on my machine which appears to do nothing. which l also produces no output. Is this a real command, and does it actually do anything?
1
vote
1answer
134 views
Right way to colorize ls?
Sometimes ago, I used Ubuntu and had colorized ls, grep "out of the box". Now I install KUbuntu and ls is plain text by default.
I tried to discover something about it and notice that there is ...
1
vote
1answer
70 views
Why are “ls” and “stat” returning different ownerships for the same object?
This is in a continuation of question here
I run this command as root user
chown someuser:someuser /mnt/my-address
and then
# ls -l /mnt/my-address
response is
total 16
drwx------ 2 root root ...
0
votes
1answer
112 views
Can I change the default of “block-size” in commands?
Several commands use --block-size 1K as the default and I find myself counting numbers. Is there a way to automatically and permanently change the block-size of commands like du,ls,df to greater ...
2
votes
4answers
417 views
Can I use ls -R to show up to 2 folder depth?
I have a folder tree that looks like this
main/
main/34532-23423632-2354/what-i-want/sth/other/blah-blah
main/54634-56345634-3422/what-i-want/sth/
....
...
0
votes
1answer
816 views
Missing php.ini after apt-get install php5
I just installed php5 as root via apt-get install php5, and for whatever reason I can't find my php.ini file.
Running locate php.ini or ls /etc/ | grep php.ini both yield no results.
Is there ...
19
votes
2answers
4k views
Difference between 'dir' and 'ls' terminal commands?
I've been trying to find the difference between using the dir and ls commands in terminal. I know ls is the traditional unix method of viewing the files in a directory, and that dir is the windows ...
4
votes
3answers
783 views
change default command options
When I enter command
ls
I see a list of files and directories in current directory, the list displayed is quite annoying.
Rather, I like to execute ls command with -1 option like
ls -1
My ...
7
votes
3answers
861 views
How to find all PDF files in directories and their subdirectories?
I want to list all PDF files in the directories of the current working directory. What command can do this?
I remember a combination of ls and */*.pdf but don't remember what exact combination.
6
votes
1answer
168 views
automatically run ls after changing path using autocd
So everytime I change the directory I would like the new path to automatically get listed with ls.There are solutions if the path gets changed using cd but I never found a solution that would work ...
4
votes
2answers
970 views
Is there a way to do a ' ls -R | grep “aname”* | rm; to remove multiple files in multiple directory
I have installed (compiled) emerald. The command make uninstall didn't work (there is no makefile as it is just a script). So I decided to remove the file manually. But there were a lot of files.
...
2
votes
1answer
91 views
List files that were changed between a certain datetime [duplicate]
Possible Duplicate:
How to remove files modified between particular dates?
How can I list all files recursively in a directory that were changed within a certain timespan?
like between ...
1
vote
1answer
150 views
subshell ls -lh “$(find /music -type d)” doesn't return list, instead results of find command
I'm trying to list the details of all the directories in my music folder using the following command:
ls -lh "$(find /music -type d)"
However all I get is the return of the find command. Is this ...
5
votes
3answers
170 views
How do you get details from the output of the locate command?
When I run the ls -l command I get details about the files in the current directory like permissions, owner, group, file size.
Is there a way I can get these same details instead of just the ...
1
vote
1answer
310 views
Preserving multi-column output from ls when paging
By default, ls displays its output in multiple columns, but when it's sent to a pager such as less it's reformatted as a single column. Is there any way I can page the original, multiple-column output ...
0
votes
5answers
2k views
How to enter every directory in current path and execute script
I want to enter every directory retuned by ls command and execute script.
I tried this (and many other things), but it just does not work
ls | awk '{print $1" && pwd"}' | xargs cd
How to ...
0
votes
2answers
270 views
Problem using `sed` to colorize `ls` output (Tenth back-reference `\10` not working)
I had asked this question a while back: Is it possible to colorize permissions-part of the output of ls?
While the accepted answer in that question is OK, I now want to do the same thing without ...
2
votes
1answer
237 views
What's the easiest way to remove the “total <size>” line from the output of ls -l?
The best I could find via Google/man ls was:
ls -l | grep -v '^total'
Is there something I'm missing in the flags to ls?
Also, why is the total size in kb, regardless of the -h flag? scratch that, ...
3
votes
1answer
521 views
Summarize file sizes of a directory structure?
I have written a small backup script with rsync. I would like to monitor its progress by comparing the total file sizes on the source and destination directories. du Is inaccurate because it measures ...
1
vote
1answer
635 views
“ls” not working on Ubuntu 10.04
All of the sudden the handy command ls stopped working on my Ubuntu 10.04 server.
The only thing I did was add a new entry to the PATH environment variable and that was all.
Here is the result from ...
8
votes
3answers
587 views
Tell `ls` to sort by regular ASCII codes, not “intelligently”
I have a couple files and ls sorts them like this:
a
_b
c
but I want to have
_b
a
c
How can I do that?
4
votes
2answers
3k views
How can I direct a pipe input to ls command?
When I type sth. like that
find . -name *foo* | ls -lah
it gives me a ls-output of 'pwd' like I had no file(s) given to 'ls'.
To simply use
ls -lah $( find . -name *foo* )
works well (when the ...
2
votes
2answers
976 views
Why doesn't this wildcard work the way I expect?
On my user folder, I have folders like D ropbox, D ocuments, D ownloads & d ump.
ls a* should list all the files whose name starts with a. Right?
But when I gives the command ls d*, instead of ...
4
votes
1answer
630 views
Why does ls -lh give me ls: invalid option — 'h'
I'm using Interpid (I know I need to upgrade). When I try and use the -h option with ls I get an error. I swear this used to work, and the man page says it should. Any ideas?
$ sudo ls -lh
ls: ...
8
votes
2answers
1k views
What is the double slash (//) directory?
I mistakenly typed cd // instead of cd /. To my surprise, current directory showed up as //.
What is that directory? Why does it exist?
apple@snipped $ pwd
/home/apple
apple@snipped $ cd /
...
4
votes
2answers
1k views
Best way to list 100 first files in a directory sorted by time
What would be the best way to list 100 first files in a directory sorted by the created timestamp (oldest first). The directory is quite large (around 100000 files). ls piped to head takes an awful ...
12
votes
3answers
4k views
How to activate pagination for ls command?
What is the equivalent option for the ls command to activate pagination as in DOS the dir /p does?
9
votes
5answers
3k views
In the output of 'ls -n', what does the the second column mean?
When I run:
ls -n
I get something like:
-rwxrwxrwx 1 1000 1000 765528 2009-10-15 18:41 file1
drwxr-xr-x 10 1000 1000 4096 2010-12-07 20:50 dir1
drwxr-xr-x 3 1000 1000 4096 2010-10-24 ...
10
votes
5answers
5k views
How to list all the files in a tree (a directory and its subdirs)?
For a task of mine I need to list all the files in a tree (a directory, all its subdirs, all subdirs of those, etc.).
I'd prefer to see them in Nautilus or Krusader, but a command-line solution is ...


