The ls command lists the contents of a directory.

learn more… | top users | synonyms

1
vote
1answer
93 views

GeeXbox ls shows no date?

Recently, I tried connecting to my GeeXbox via WinSCP but got an error indicating the output of ls could not be parsed. Apparently, my ls does not include a time stamp! What might be the cause and ...
1
vote
1answer
194 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?
1
vote
1answer
828 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 ...
1
vote
1answer
672 views

M-x ansi-term colors in Emacs 24.x

I have noticed that some colors in LS_COLORS don't work when running a shell inside M-x-ansi-term in Emacs. For exmaple; di 00 94 is supposed to turn on bold on light blue on directories on ...
1
vote
1answer
435 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 ...
1
vote
1answer
478 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
2k views

Difference in file listing for SSH and SFTP [closed]

I have SSH access to a server and I have never bothered to use SFTP until now. I transferred a file using FileZilla to the server. However, the weird thing is that the file doesn't show up when I ...
1
vote
0answers
11 views

LS_COLORS mixing matching criteria, e.g. file extension and hardlink

I'm wondering if there is a way to keep the characteristic color of the extension type in ls --color=auto and underline the file if is a hard link. For instance, if I do ...
1
vote
0answers
31 views

Who is this UID and GID? [duplicate]

When I do an ls -l on my ubuntu machine it shows the number 6226 as the UID and GID for some directories. Why? Most files and directories are owned by root, or by ubuntu (which is my usual login ...
1
vote
1answer
88 views

change LS_COLORS behaviour

I am trying to modify LS_COLORS behavior. Presently it (say for sh or py), changes color depending on if it is executable or not, as shown here But, I want all my script, executable or not, have ...
1
vote
0answers
132 views

How to understand the security context in “ls -Z”?

After referring "man ls", it shows "ls -Z" can display the security context: -Z, --context Display security context so it fits on most displays. Displays only mode, user, group, security ...
1
vote
2answers
105 views

ls or find option to exclude binary files

How can I list only files that aren't compiled code in the current directory? I'm reviewing the custom scripts and code on several HPUX and Linux servers before transferring them to a newer system. ...
1
vote
1answer
161 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?
1
vote
3answers
817 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.
1
vote
2answers
56 views

`ls` fails for directory copied from Win and OSX [closed]

I'm not able to ls on a folder that I have just transferred from win7 to OSX via a FAT32 drive. I don't know how to search for an answer for this issue. I've attempted the following: sudo chmod ...
1
vote
1answer
145 views

Display full ISO time in OSF1

I am working on an HP OSF1 (Tru64) based server and need to display file listings with the full-iso time format style. Example of this in Ubuntu Linux, user@hostname:~/Desktop$ ls -lrt --full-time ...
1
vote
0answers
144 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 ...
0
votes
6answers
5k views

How to list files starting with “a” or “c” from /etc.

I tried ls /etc/[ac]* but it shows directories starting with a or c, and their entire contents, not the files starting with "a" or "c".
0
votes
4answers
64 views

What is the command to find the read/write permissions for a single file?

I know that ls -l lists the permissions of every file in a directory but what is the command if I want to see the permissions of just a specific file?
0
votes
2answers
291 views

meaning of capital S in long ls output [duplicate]

What does this long listing mean? $> ls -l developer.haml -rw-rwSr-- 1 humon apache ...... I know what a usual listing means and I know all about what it means to be read 'r', write 'w', and ...
0
votes
3answers
201 views

How to delete directory ' :q!'? [duplicate]

Accidentally, i have got this directory created in my home, drwxr-xr-x 2 ubuntu ubuntu 4.0K 2012-09-06 07:27 :q!/ I want to remove this somehow. I have tried using escape characters in double ...
0
votes
2answers
89 views

ls command lists hidden files

When I run ls command I get files like opencv.sh~ in my output which is not visible if I check the home directory. Basically, it also lists hidden files without supplying any other parameter. How can ...
0
votes
2answers
34 views

Why is there a minor number in /dev for directories such as pts?

This is a part of /dev in CentOS 6.6. What is the meaning of the minor number for directories like ., .. , bsg, block and ... ? drwxr-xr-x. 18 root root 3800 Jul 3 06:00 . dr-xr-xr-x. 21 ...
0
votes
3answers
111 views

Concat 1000 files within a directory [closed]

I know we can concat files by cat file [file] [[file] ...] > joined-file. I have directory which contains lots of files. I want to concat all of them. I want to concat 1000 files irrespective of ...
0
votes
4answers
207 views

Foreach loop for ls output

I am trying to process some files in directory using foreach loop for ls output: IFS=$'\n' for i in $(ls -1Atu); do echo "$i" done At first time i thought it works, but when i created file ...
0
votes
3answers
503 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
1answer
275 views

Delete empty directories using 'ls' command

I want to delete empty directories without using find command find . -empty -type d -delete. like the following: if [ "$(ls -d *)" ]; then echo "Not Empty" else echo "Delete" fi How do I ...
0
votes
4answers
68 views

Why does my “ls -a-l /home” not work?

Marias-MacBook-Air:~ mariasharapova$ ls -a /home . .. Marias-MacBook-Air:~ mariasharapova$ ls -a-1 /home ls: illegal option -- - usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] ...
0
votes
3answers
86 views

“Other” permissions on files

To my understanding, the last three character of file permission printed by ls command is about other user's file permission. If the other user"s" have separate file permissions to this file, what ...
0
votes
3answers
5k views

Use of ls with wc command

What does the command : ls | wc -l do? I know wc <filename> gives lines, words, and characters, and wc -l <filename> print the line count. But how it is being used with ls` ...
0
votes
1answer
168 views

wc - setting a terminating character

I've got that far: wc --files0-from=FILE lets one get the word count of a list of files. Each entry in this list mus be terminated with an ASCII NUL character. Question: A way to set a terminating ...
0
votes
1answer
4k 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
1answer
1k views

Asking ls to only list files in a path that match a specific glob/regex

In Zsh: Is there a way to use ls to only list files and folders in the current directory that match a specific globbing or regex pattern? For example, say I have multiple files that start with the ...
0
votes
1answer
109 views

Meaning of chmod 1775

Created a folder "Sample_dir" and analysed its permissions. $ mkdir Sample_dir $ ll Sample_dir/ total 36 drwxrwxr-x 2 user user 4096 Jul 1 19:26 ./ drwx------ 71 user user 28672 Jul 1 19:26 ../ ...
0
votes
2answers
40 views

'+' and 's' in permission strings

If the ls -l command gives me a permission string like rwsr-s--x What does the 's' mean? The only sources I found mention that it can be present sometimes but do not elaborate. What does a '+' ...
0
votes
1answer
60 views

What's the -alhF flag in ls?

What is the -alhF flag in ls? I can't find it in the man page.
0
votes
3answers
479 views

How do I copy the latest file from one directory to another?

I have 3 zip files in a directory. I want to copy the most recent version to a backup directory. My code works fine for .sh and other files, but not for .zip. Is there something else I have to do? ...
0
votes
2answers
136 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
1answer
3k views

ls command - list files containg speccific string in file name and belong to specific type

I am new to linux. Is it possible for a ls command to return a list of files containing "PRO" in its file name and belong to pli file type. I have researched and identified that ls -c -lt *.PLI will ...
0
votes
2answers
2k views

Bash: iterate with variable on the lines of `ls -1` output

In a simple cycle like the following for f in $(ls -1) ; do something done I would like to store each line of the output of ls -1 in the variable f. Is there a way to do this ...
0
votes
1answer
200 views

Understanding ls -l output

When I run ls -lrt command on a Unix folder , I get the following output MyServer> ls -lrt total 10 drwxr-x--- 3 UnixUser other 512 Jul 22 2011 FolderA lrwxrwxrwx 1 UnixUser other ...
0
votes
2answers
1k views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
0
votes
1answer
36 views

get List of files which are unique

I have a directory in which files are created as abc.sh.ID.datetimestamp.id.log In the filename abc.sh, ID are always same (there are 1000's .sh's and ID's combination in environment). datetimestamp ...
0
votes
4answers
41 views

Single line command to cat last file in ls -lrt output? [duplicate]

System log files are serialized and I use ls -lrt to show me the most recent file. I then cat that file. This requires typing a long serial number each time. How can I cat the last file appearing in ...
0
votes
2answers
49 views

Get number of files in each directory [duplicate]

I have a directory with a very large number of subdirectories (~800) that were generated programmatically. I want to get a count of the number of files in each of these subdirectories to check for ...
0
votes
5answers
93 views

List only the count of all files/directories for the directory tree of present directory

I want to list the number of directories under each subdirectory tree of the present directory. As there are too many directories, I can't go into individual directory and check. Something like the ...
0
votes
2answers
47 views

Is there a way to list files before mount a disk partition

Suppose there are several partition in my computer. So I'm not sure where is the folder I have to access. usually what I do is mount all the portions first and then search one by one. Is there a way ...
0
votes
2answers
120 views

How can I shorten an if then else using the [] format

I want to shorten this to a one liner: if ls --version 2>/dev/null | grep -q 'coreutils'; then alias ls='ls --color=always' else alias ls='ls -G' fi I frequently use [] for conditionals, e.g. [ ...
0
votes
2answers
594 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 ...
0
votes
2answers
103 views

What is the alternative for ls command in linux? [duplicate]

How can I list the current directory or any directory path contents without using ls command? Can we do it using echo command?