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'm currently studying Bash shell and have encountered command ls -F. I know it ls function is to append indicators to items lists, so to distinguish between different file types. I know that / is appended to directory and * is appended to executable files. But I have checked the manual page on ls command but couldn't find any information on indicator =>#|.
Could someone tell me what they represent? And it would be even better if can inform me where to find this kind of information when in need.
Try info ls, under "What information is listed":
‘-F’
‘--classify’
‘--indicator-style=classify’
Append a character to each file name indicating the file type.
Also, for regular files that are executable, append ‘*’. The file
type indicators are ‘/’ for directories, ‘#’ for symbolic links,
‘|’ for FIFOs, ‘=’ for sockets, ‘>’ for doors, and nothing for
regular files. Do not follow symbolic links listed on the command
line unless the ‘--dereference-command-line’ (‘-H’),
‘--dereference’ (‘-L’), or
‘--dereference-command-line-symlink-to-dir’ options are specified.
Related
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 3 years ago.
Improve this question
I have set about two thousand paths in PATH variable (I know its excessive but I experiment something) and whenever I try to run any command I get the following error, in this case its ls.
-bash: /bin/ls: Argument list too long
I have checked several topics about the error message. However, I was wondering what does PATH var length have anything to do with arg list error.
Would anyone have an idea/explanation?
Thanks!
The same buffer is used to pass both command-line arguments and the environment to a new process. In this case, your value of PATH seems to be big enough for the environment to exceed whatever limit your OS places on the size of this buffer. Even a zero-argument list, therefore, is too long.
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'm preparing a batch compiling sh file in Ubuntu. It is using dir command to get a list of files (and some string processing to extract names). But this may not be the best way (but easy enough) of getting list.
Question: do all Linux distros answer "dir" command same?
dir /usr/lib/nvidia-*
/usr/lib/nvidia-396:
alt_ld.so.conf libnvidia-cfg.so.396.54
bin libnvidia-compiler.so
ld.so.conf libnvidia-compiler.so.1
libEGL_nvidia.so.0 libnvidia-compiler.so.396.54
Yes, the dir tool should work the same across any distribution, provided the distribution doesn't have its own modified version or has this tool missing etc.
You might find this helpful for some background into dir tool
https://www.howtoforge.com/linux-dir-command/
You can use tree command to get all files and filter whatever you want.
tree -f -i .|grep .*\.py$ here it greps all .py files.
here's tree doc
example:
root#fdada3432377:/usr/src/app# tree -f -i conn* |grep .*\.py$
connection/__init__.py
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
I see these files many times when I use the command ls -a . But I want to open that file and access that file. What material contain that file. How it can be done ?
in linux all files whose name starts with . is hidden files.
these files are not shown when you use 'ls', but doing 'ls -a' shows these hidden files too.
if you execute ls -a on your home directory you will see lot of such files. (.profile .bashrc .history etc)
such filenames are given to config files. so most of these files will be in a text format..and may be in other format depending on to which application it belongs to.
to know the format use the following command file filename
to see text files cat filename
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 8 years ago.
Improve this question
Let's say I wish to run all the scripts in a directory. If I do ./*.sh, which order will they run in?
Directory:
1.sh
2.sh
3.sh
To run all the scripts, you must run them separately:
for f in ./*; do
"$f"
done
The pattern will produce an alphabetically sorted list of scripts, where "alphabetical" is defined by your current locale.
Your attempt:
./*
would expand to a list of matching files, which the shell would then treat as a single command. The first script would be executed, with the remaining script names passed as arguments to the first.
They are alphabetically sorted. From the bash manual:
After word splitting, unless the -f option has been set (see The Set Builtin), Bash scans each word for the characters ‘*’, ‘?’, and ‘[’. If one of these characters appears, then the word is regarded as a pattern, and replaced with an alphabetically sorted list of file names matching the pattern.
However, in order to run them as you expect, you'll need to read #chepners answer (Thanks!, I must admit that I wouldn't expected that)
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 9 years ago.
Improve this question
If I run find (Ubuntu, specifically), can I expect it to give me the same order of results every time? (Assuming, of course, that the actual files haven't changed.)
In other words, if I run
$ find foo
and it gives me
bar.txt
foo.txt
can I expect that it will never give me
foo.txt
bar.txt
?
The answer is "probably" but you shouldn't rely on it because any number of things can affect it.
What order do you want the files in? Decide on that and then use a find command (perhaps piped into sort) which reproducibly gets the result you need.
The order of the files is determined by the fine details of the filesystem format and the filesystem driver. You can't rely on it. Depending on the filesystem and operating system, here are things that might change the order:
A file is created or removed in a traversed directory (even if none of the listed files changed).
The files are moved around (e.g. transfered to a different filesystem or restored from backup).
A defragmenter or filesystem check ran and decided to move things around.
If you want a reproducible order, sort the results. find … | sort will do nicely if none of the file names contain newlines.