Questions tagged [ls]

A utility in Unix-like systems such as Linux used for listing files and directories.

A utility in Unix and Unix-like operating systems used for listing files and directories. It is analogous to the dir command used in DOS and Windows.

Documentation

1314 questions
-2
votes
3 answers

What do these commands mean and do?

What do these commands mean and do? "ls > l" and "ls >> l". I have tried them, but it seems as if they do the same thing - create a file named "l".
A MUSE
  • 35
  • 6
-2
votes
5 answers

get the first word as result of ls -l

I need to use ls -l and I would like to have as result just the first word of the file name for instance for a result like this -rw-r--r-- 1 root root 9 Sep 21 23:11 best file 1.txt I would like to have only best as result…
Maxrock70
  • 21
  • 6
-2
votes
1 answer

how to write ls command in c using execvp

i am trying to write a simple ls command so i'm input "ls r" and i want to check if my code is allright. the output does not showing anything. this is the code: int main(void){ char *line; char *args[16]; pid_t pid; line =…
tokenaizer
  • 208
  • 1
  • 5
  • 17
-2
votes
2 answers

Quicker way to navigate directories in Linux?

Suppose I'm at a terminal in Linux/UNIX and I run ls and see the following displayed: my_file_1.txt my_file_2.txt Now I want to open the first one in gedit, or maybe it's a folder and I want to enter it. Is running gedit my_file_1.txt the fastest…
pminogue
  • 143
  • 1
  • 1
  • 10
-2
votes
1 answer

Parsing ls, not recommended

I received a advice for do not parse ls, like describes in this website: Don't parse ls. I was looking for DAILY files in my directory so that's what I did then: for f in *.DA*; do [[ -e $f ]] || continue for file in $f; do …
ranu
  • 622
  • 15
  • 25
-2
votes
2 answers

How to find last modified file and it's timestamp no later than today?

I have a list of files named filename.${date}, for example foo.20121102 and I want to print the last modified file that has the timestamp up to today using bash toolset.
vehomzzz
  • 42,832
  • 72
  • 186
  • 216
-2
votes
3 answers

"ls" command output

I'm running ls -l which brings the following output: -rw-r----- 1 webadm webgrp 168 Jul 19 16:00 SYNCHRO_20120719_1600.csv Is there a way to have just get the last two fields? i.e: 16:00 SYNCHRO_20120719_1600.csv
Mercer
  • 9,736
  • 30
  • 105
  • 170
-3
votes
1 answer

Command ls - A $path doesn't see desktop directory as empty. How come?

if [ "$(ls -A $path)" ];then echo $path dirpath = "$mainPath/$path" fi
-3
votes
1 answer

Why doesn't "ls -ad */" show both hidden and non-hidden directories?

Why doesn't the command: ls -ad /* ...show both hidden and non-hidden directories? And given this does not work, what would be the simplest command for showing hidden and non-hidden directories, without showing files? Thanks!
-3
votes
1 answer

if i wanted to do ls on files would this suffice?

ls | grep -v "//|=/|@/||" will ls then piped to a reverse grep work? This question seems to not meet the quality standards, maybe if i write more random things it will be a quality question.
Doboy
  • 10,411
  • 11
  • 40
  • 48
-3
votes
1 answer

Using ls command result in a loop

I want to use the result of ls command in a loop to check if for example the first line is a directory, second etc. For example I have this folder that contains one directory the script should display: 18_05_2018 is directory enter image…
-3
votes
1 answer

use Ls -l in script shell linux and separate between results

when i execute this script that i had made #!/bin/bash for object in $(ls -l) do echo $object done it's displayed as below when i execute my script i want to have a result like this i was trying a lot of things but its not working please i need…
rim
  • 1
  • 3
-3
votes
1 answer

How to ls both alphabetically and by date last modified

So I was trying to do some research on it, but I could not find the answer. So I know that ls -l returns all things in the folder alphabetically, whilst ls -alt returns a list of files by their modification date, though without respect to…
SomeStudent
  • 2,856
  • 1
  • 22
  • 36
-3
votes
1 answer

creating a very specificly order text file with ls

I have a python script that reads in input files from a text file. Ideally the text file should have one line per directory and that line should have all the files in that directory separated by a comma and with the full path, so something like…
-3
votes
1 answer

file names in rotating order

I am working on a music player using mpc function and I want to implement a "next-folder" function. I need to change the order of ls output in this manner... If I have this files in a directory... folder |_file 1 |_file 2 |_file 3 |_file 4 …
ivallesp
  • 2,018
  • 1
  • 14
  • 21
1 2 3
87
88