The ls command lists the contents of a directory.

learn more… | top users | synonyms

0
votes
1answer
24 views

Change the way folders are displayed in terminal [duplicate]

I moved over from Xubuntu to Fedora. In a colored Xubuntu terminal the folders appear in bold blue wheras in Fedora they appear as normal blue. I'm familiar with ANSI codes for colors and style but ...
4
votes
2answers
160 views

Appending works without >> when redirecting standard output and error

I have a file test.txt and have no file named test. When I tried ls test test.txt > new 2>new I was expecting new to be overwritten since >> is not used. But in the output file I got ...
2
votes
3answers
31 views

How to determine if a soft link's target is a directory or a file?

Given the ll command outputs as follows #> ll lrwxrwxrwx ... How to determine if a soft link's target is a directory or a file from "lrwxrwxrwx"?
3
votes
2answers
483 views

How to ls without recursive

I am trying to ls some files with a pattern in a directory. I only want to scan the first level not recursive. My script: for i in $(ls $INCOMINGDIR/*$BUSSINESSDATE*) do echo $i; done Above ...
3
votes
2answers
646 views

Why does ls display a non-existing file?

I want to list all the files whose name begins with uppercase: [root@localhost /]# ls /usr/bin/[[:upper:]]* /usr/bin/AtoB /usr/bin/GenIssuerAltNameExt /usr/bin/PKCS12Export ...
0
votes
2answers
61 views

Making a text file of list of directory entries in bin

How could I make a text file of the list of directory entries in /bin/ along with the attributes of all the files stored there?
1
vote
1answer
64 views

How can I list hidden directories, then directories, then hidden files and finally files with ls?

I'm trying to figure out how to list the contents of a directory in the following group order: Hidden directories Non-hidden directories All other hidden files (including regular files, symlinks, ...
2
votes
0answers
35 views

What uses Linux “application memory”?

Just for fun, I wanted to watch what ls -lR / does to my "buffers" memory on a Linux system. As expected, the value increased. But I noticed that the "application memory" (i.e. "used" - (buffers + ...
0
votes
0answers
30 views

Pipe to `ls` Not Working as Expected [duplicate]

When I issue: [dave@dhost ~]$ which tar | ls -l I get the output of ls -l of the pwd. I expected to get: -rwxr-xr-x. 1 root root 395472 Feb 21 2013 /bin/tar Why doesn't the pipe work as I ...
1
vote
1answer
48 views

List files from time X to time Y

How to list out all files created between from 'x' to 'y' time? I want to list out files created between "29-dec-2014 18:00" to "30-dec-2014 18:00". Using ls or stat?
2
votes
1answer
35 views

GNU ls long listing without permissions/mode bit

Is it possible to make GNU ls omit permissions/mode bits in long listing? If not, is there an alternative, practical and commonly available program that is more flexible?
3
votes
3answers
104 views

How to inspect the contents of /dev/sdt?

I have what I hope is not a huge problem, but could end up being a very large problem. For some context, I mistakenly ran this command on my 27'' iMac: sudo dd if=ubuntu-rescue.img of=/dev/sdt ...
2
votes
1answer
30 views

Disable of coloring for ls on NTFS filesystems

I like to have the output of ls colored so I quickly can spot files of specific types, however I have a separate disk in my computer which uses a ntfs-3g filesystem, this means that everything has ...
1
vote
0answers
17 views

List all files with only arbitrary file path read, but no directory listing nor sudo [migrated]

I have found a path traversal vulnerability that allows me to read any path on the server that does not require sudo. To fully exploit this, I would like to know which files exist in each directory ...
1
vote
3answers
53 views

ls option to cancel '-h'

I aliased ll to ls -alh. Is there an option to cancel the -h temporarily, so I can do ll -? instead of ls -al?
1
vote
1answer
44 views

ls --color=auto (dir colors) not working in one directory

I changed ownership of a folder to provide restricted access to some users (it previously was only visible to root) and after that, all files are now one color (bright green) and directories are blue. ...
0
votes
1answer
23 views

How to create a file name for the pipeline to delete all files?

So I want to delete all files in my current directory using the following pipeline: ls | sed -rn 's/(.*)\.jpg$/mv -n & \1.jpeg/pi' | sh How to create a file, named so that running the above ...
0
votes
3answers
57 views

Number of files in a directory starting with specific text

How to get count of files in a directory starting with specific text like dataxxx.csv
2
votes
3answers
156 views

only show the source file and target linked file using `ls`

I can show the target file that a link points to using ls -l: snowch$ ls -l /usr/local/bin/mvn lrwxr-xr-x 1 snowch admin 29 12 Dec 08:58 /usr/local/bin/mvn -> ../Cellar/maven/3.2.3/bin/mvn Is ...
1
vote
3answers
381 views

List files that do not begin with a specific prefix

I need to list only the files in a directory that do NOT begin with qc_dl, qc_dt or qd_df, but that also DO end in .sas. I can list the files that do not begin with "qc_dl" as such: ls -I "qc_dl*" ...
1
vote
3answers
84 views

What does “>” do vs “>>”? [duplicate]

I am currently doing preparation for my GCSE computing controlled assessment on Linux. I type ls > list and ls >> list into the command line, but it does not do anything. I have googled it ...
0
votes
2answers
60 views

How can I capture two columns of ls output in a bash script

I want to create a script to delete any directories with numeric groups. What I have so far captures and analyzes the group: #!/bin/bash re='^[0-9]+$' for x in `/usr/bin/ls -l /var/indexes | sort ...
0
votes
2answers
177 views

Export file names of a directory to csv

I have a question regarding exporting folder names to a csv file. I have read already many entries in the web to such topics but on nearly all the topic was about exporting filenames and size and ...
0
votes
3answers
451 views

How to print only certain characters?

I have to translate the permissions of a file this way: r ► c w ► s x ► e Then, I must extract the group of characters which are related to owner group. Last step is to print that group of ...
0
votes
2answers
53 views

How can I recover disk space shown by the difference in disk usage between ls and du

I have a one Terabyte external hard disk drive that I intend (should have done this long ago) to use for backups, and I have done a lot of experimenting to get my mind round it. When I looked again ...
0
votes
1answer
49 views

How can I write an alias for cd such that it will fire ls after going into the directory to which I just cd'ed into? [duplicate]

Lets say I want to do cd home and then ls -lrth. I want these two things combined into a single command. I tried writing an alias, but it didnt work. Can you help me ?
2
votes
3answers
66 views

Remove files from listing that are created/modified on Saturday

I am not sure if it is possible. I do ls -l, it gives all the files in the current directory. Is there a way to say list only files that weren't created/modified on Saturday's with shell command?
2
votes
3answers
72 views

How to know list of directories under a filesystem?

If I run sudo df -h command, I got below output: Filesystem Size Used Avail Use% Mounted on /dev/sda2 12G 9.5G 1.1G 91% / /dev/sda4 3.8G 1.5G 2.1G 41% /home ...
1
vote
1answer
60 views

Ls -1 Command in linux on Ubuntu dosen't show details beside the name of each directory or file in the list? [closed]

I am using Ubuntu and when i issue this ls -1 command there is no details appear in-front of the directories and files names there is only a blank space ..what can cause this ?
0
votes
0answers
39 views

Failed to list directory contents: process waits infinitely

I use Linux Mint 13, and sometimes (rarely) I find myself not being able to list my home directory contents. When I try to do so: $ cd $ ls then, ls just waits indefinitely. The same with any other ...
2
votes
2answers
54 views

ls doesn't give me the same as cd + ls to the same folder

$> ls ../../../../.. Doesn't give me the same result as $> cd ../../../../.. $> ls Why? Something with links? What's going on? [ johanrj@jamin ] ...
4
votes
2answers
537 views

Basic commands in Unix not working i.e: -bash: ls: No such file or directory

I'm new to Unix and in the process of installing a program for my dissertation I must have played with the PATH for the basic Unix commands such as ls. Every time I type ls and the directory name I ...
3
votes
4answers
94 views

Determining the number of files and subdirectories in Linux

When displaying directories in linux using ls -ld, I get something like this: user@shell:~/somedirectory$ ls -ld drwxr-xr-x 2014 K-rock users 65536 20011-11-05 11:34 user@shell:~/somedirectory$ ...
1
vote
3answers
106 views

Print full pathname with `ls` and `find`

I want ls to print with absolute pathnames, how do I do that? find / -type d -mount -exec ls -ls {} \; ls is printing only the relative file names within the directory.
4
votes
6answers
369 views

How can I list files by type with ls?

When I use the ls command with the option -l, the first string of letters gives the info about each file, and the first letter in this string gives the file's type. (d = directory, - = standard file, ...
1
vote
2answers
111 views

how to sort files by their permissions using ls?

I have a large number of files and directories in one directory. I need to sort them in terms of the permissions. For example drwx------ drwxr-xr-x drwxr-x--- I am just wondering if we can sort ...
3
votes
1answer
70 views

Changing the spacing between files in ls

This is more of a cosmetic question but this is really bugging me. On OS X, when I run ls -G (or use CLICOLOR=1) instead of regular ls it changes the spacing of the columns, as you can see in this ...
3
votes
5answers
157 views

List files with line count and date

I want to be able to list files showing the number of lines the each file has and the date. I can happily get the line count using wc -l *. Not a problem. I can get the date using ls -l. Is there a ...
3
votes
1answer
486 views

It's bad to use ls -A to list hidden files?

I want to list every file, including hidden files, in the current directory. I don't want to include the parent (..) and current (.) directory. I found this: how to glob every hidden file except ...
3
votes
3answers
151 views

Sorting directories by last modified date/time of the same-named contained file

Is it possible, using grep, find, etc, to sort a list of directories by the last modified date of the same-named file (e.g., file.php) within? For example: domain1/file.php (last modified 20-Jan-2014 ...
0
votes
1answer
53 views

Executable directory? And chmod o+w changing the terminal directory color?

What does an executable directory mean? If o+w is set the directory changes colors to a background green, what does this mean? Why doesn't it do it for ug+w, but only for o+w? Additional question ...
0
votes
2answers
152 views

proper way to iterate through contents in a directory [duplicate]

I need to iterate through every file inside a directory. One common way I saw was using the for loop that begins with for file in *; do. However, I realized that it does not include hidden files ...
-1
votes
2answers
99 views

Matching multiple patterns with ls

I'd like to get a list of fail logs in the current directory for use in an outside script, the logs are determined with the pattern FAIL in the filename, so I've been using a FAIL* to feed my script ...
1
vote
2answers
170 views

sort and ls — why aren't capitalized letters sorted first?

I want a sorting like this, with capitalized letters before lowercase: -rw-r--r--. 1 0 0 183 2014-10-14 20:17 ./CHECKSUMS.md5 -rw-r--r--. 1 0 0 185 2014-10-14 20:17 ./CHECKSUMS.asc ...
0
votes
2answers
80 views

ls hard link question

I run ls -la on the Volumes directory. It shows the MM dir to have 9 hard links and the Media dir to have 12. If I then cd to the MM directory and run ls -la, it shows only 7 items whereas if I cd to ...
1
vote
2answers
42 views

Listing folder contents during cd command

I might be mistaken here, but I was watching someone navigate using the cd command, and without actually executing it, they were able to show the folder contents of the current folder. So if I type ...
6
votes
1answer
92 views

???? files in ls -l output

I see ghost files in red colour inside some of my directories: [drey@cyan|23:54|~/downloads]ls -la ls: cannot access teamviewer9_linux.deb: No such file or directory total 1318096 drwxrwx--- 1 root ...
2
votes
2answers
470 views

Change file timestamp and display hour instead of year with ls

I want to change a file's date to tomorrow 21:00. I used touch, but when I type ls -l the year of the file is displayed instead of the hour. -rw-r--r-- 1 ABCD DEF 0 sept. 30 2014 test01 -r-xr-xr-x ...
15
votes
4answers
3k views

Why does “ls | wc -l” show the correct number of files in current directory? [duplicate]

Trying to count number of files in current directory, I found ls -1 | wc -l, which means: send the list of files (where every filename is printed in a new line) to the input of wc, where -l will count ...
0
votes
1answer
123 views

External Hard Drive Issue on mac

After the cd /Volumes command when I type ls it shows me my hard drive name twice, with different permissions. After that when I try to use mkdir to create a directory in the external hard drive I'm ...