What is the operand in ls -LA do? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
As the title says what does -LA do in a ls command?
I tried reading the manual for ls and this what it said:
-A List all entries except for . and ... Always set for the super-user.
-L Follow all symbolic links to final target and list the file or directory the link references rather than the link itself. This option cancels the -P
option.
But I'm not quite sure what those mean.

the ls command prints a list of files and folders in the current directory.
When using ls -A, the command prints out ALL files and folders in the current directory. This includes hidden files and folders (like files/folders starting witch a dot). However, . (current directory) and .. (parent directory) will be ignored.
When using ls -L the command will follow symbolic links and print out the location of the reference too.
When combining this 2 options you get ls -LA which prints out a list of ALL files and folders, and also prints out the references to symbolic links in the folder.
Just try it out in the terminal. You'll see the difference.

Related

Why I can not give the 'ln -s' command an operand through out the command sub $(ls ../*.txt)? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 months ago.
Improve this question
ln -s $(ls ../*.txt)
When I do the command above it replay with an error message saying : "ln: target '../foo.txt' is not a directory".
foo.txt is the first file that ls command has found in the parent dir.
I am trying to make symbolic links for all the files in the parent directory which ends with ".txt".
Can you please explain why my command did not work ?
You forgot the directory name to put all the links into. If you want them put into the current directory, use ..
There's also no need to use ls, and you'll get the wrong results if any of the filenames contain whitespace or wildcard characters, because those will be processed in the $(...) output. Just use the wildcard directly.
ln -s ../*.txt .

How to filter results using wildcard in linux command line [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 11 months ago.
Improve this question
I'm trying to list the contents of /usr/bin having "ab" in their names.
I wrote the following command:
ls /usr/bin *ab*
But it didn't work.
Is there any other command that can be used to achieve my purpose?
Thank you.
Your command:
ls /usr/bin *ab*
asks ls to list two things: the contents of the /usr/bin directory as well as any files matching the wildcard *ab* in your current directory. If there aren't any files matching *ab* in your current directory, there's probably an error message before or after the listing of /usr/bin; if there are such files, they'll be listed. Instead, you want:
ls /usr/bin/*ab*
... which asks your shell to give ls the expanded list of files in /usr/bin that match the wildcard.

How to get a list of files of a huge size directory without using ls command (90GB) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
In linux server, is there a way to get the list of files in a directory
without using commands such as ls-la?
Our log directory size is too huge (almost 90GB) that
when we use ls -la command to get the list of files in that directory,
the command prompt does not come back...
echo *
... will show files in the current folder through file globbing on Bourne compatible shells.
This lists all files down one level:
echo /
In Bash, if globstar is set (set with shopt -s globstar, unset with shopt -u globstar), this will list all files recursively:
echo **
For More info, you may visit This Link
and your following problem why not you use a limit to list file?
this command may help you
ls -U | head -4
Don't know if there are other commands, but you could combine ls with other command like:
ls -la | less
which still lists your files but you can move up and down (and search) easily. less does not load all the content (your 90GB) at once but it loads lines when you move around.
Or you can save output of ls to a file to open it later
ls -la > my_files.txt

What does the command "sudo mv home/* *" do? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I know each part of this command.
sudo mv home/* *
sudo: super-user do, execute with root privileges.
mv: move a file or directory.
home/*: argument of mv command. It indicates the content of home directory. The asterisk * is a wildcard that expands to the list of files in the current directory in lexicographic order.
The next argument is the destiny folder. However, I specify an asterisk as destiny directory, and if I execute the command the folder disappear completely. So, what does the * in this case?
Let's say you have /home/userA, /home/userB and /home/userC. Let's further say you're running this in a directory that contains 1.txt, 2.txt, and a directory 3.d.
Under those circumstances, this would expand to:
sudo mv /home/userA /home/userB /home/userC 1.txt 2.txt 3.d
That is to say, both globs are expanded -- the first to the list of entries in /home, an the subject to the list of files in the current working directory -- and the result is everything being moved into the directory 3.d.
Flagged Community Wiki since this is an answer to an off-topic question.

Why does `cd ..` reflect symlink traversal, whereas `ls ..`does not? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
ls ..
means ‘list upper directorie’s files and directories.’
When I changed directory following a symbolic link, ls .. does not follow the symblic link. It just shows the real upper directory.
For example, when the directory structure is as follows,
r ┬ a - b - sub#
└ sub
(sub# is a symbolic link to sub directory)
ls ..command after cd a/b/sub gives files at r directory as I’m in r/sub. not b directory’s. But cd .. command takes me to b directory.
How can I use ls command to show files in directory b?
A directory doesn't know what symbolic link you used to get to it; .. is an actual directory entry that points to the real parent directory. But when you use the shell command cd .., bash cheats. It knows what path you used to get there (it's in $PWD), so it just removes the last component of that and changes to the resulting directory.
You can use the same trick yourself for the benefit of other commands by using "${PWD%/*}" instead of ..:
ls "${PWD%/*}"

Resources