How can I find exactly which files have been accessed after a command runs in tcsh?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
how can I find which files tcsh reads to TAB complete the second word of a command, as opposed to the first word.
I know I can just use whereis complete to see the path to *.1.gz file, but that is not specific enough to say which files are being used.
On the other hand, if I use locate complete, I am given a list of a couple hundred files, many of which aren't executable.
path tcsh locate
add a comment |Â
up vote
0
down vote
favorite
how can I find which files tcsh reads to TAB complete the second word of a command, as opposed to the first word.
I know I can just use whereis complete to see the path to *.1.gz file, but that is not specific enough to say which files are being used.
On the other hand, if I use locate complete, I am given a list of a couple hundred files, many of which aren't executable.
path tcsh locate
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
how can I find which files tcsh reads to TAB complete the second word of a command, as opposed to the first word.
I know I can just use whereis complete to see the path to *.1.gz file, but that is not specific enough to say which files are being used.
On the other hand, if I use locate complete, I am given a list of a couple hundred files, many of which aren't executable.
path tcsh locate
how can I find which files tcsh reads to TAB complete the second word of a command, as opposed to the first word.
I know I can just use whereis complete to see the path to *.1.gz file, but that is not specific enough to say which files are being used.
On the other hand, if I use locate complete, I am given a list of a couple hundred files, many of which aren't executable.
path tcsh locate
path tcsh locate
edited Sep 13 at 1:15
asked Sep 13 at 0:58
Alexander Wolf
12
12
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
I'd use strace to capture the whole session, and pick up the keyboard-read by browsing the script output, and then find all of the open-calls after that. That works with Linux and some other systems. There's a similar trace for BSD's (MacOS is a different story though).
However, tcsh likely is not opening the files but listing them from the directory. strace would help with that, too. For instance, in a quick check I see it opening the current directory using openat
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
and then using the lstat function to determine what the entries of interest are (so that it can sort them, decide which are files versus directories, etc):
lstat("xterm.desktop", 0444, st_size=1921, ...) = 0
The "." is the current directory. The program reads a list of directory entries which may be files, directories, symbolic links, etc., but those are not sorted (and types are unknown, until it uses stat/lstat to ask).
locate and whereis won't show useful data, since they do not use the same rules for finding the files as tcsh.
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I'd use strace to capture the whole session, and pick up the keyboard-read by browsing the script output, and then find all of the open-calls after that. That works with Linux and some other systems. There's a similar trace for BSD's (MacOS is a different story though).
However, tcsh likely is not opening the files but listing them from the directory. strace would help with that, too. For instance, in a quick check I see it opening the current directory using openat
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
and then using the lstat function to determine what the entries of interest are (so that it can sort them, decide which are files versus directories, etc):
lstat("xterm.desktop", 0444, st_size=1921, ...) = 0
The "." is the current directory. The program reads a list of directory entries which may be files, directories, symbolic links, etc., but those are not sorted (and types are unknown, until it uses stat/lstat to ask).
locate and whereis won't show useful data, since they do not use the same rules for finding the files as tcsh.
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
add a comment |Â
up vote
1
down vote
I'd use strace to capture the whole session, and pick up the keyboard-read by browsing the script output, and then find all of the open-calls after that. That works with Linux and some other systems. There's a similar trace for BSD's (MacOS is a different story though).
However, tcsh likely is not opening the files but listing them from the directory. strace would help with that, too. For instance, in a quick check I see it opening the current directory using openat
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
and then using the lstat function to determine what the entries of interest are (so that it can sort them, decide which are files versus directories, etc):
lstat("xterm.desktop", 0444, st_size=1921, ...) = 0
The "." is the current directory. The program reads a list of directory entries which may be files, directories, symbolic links, etc., but those are not sorted (and types are unknown, until it uses stat/lstat to ask).
locate and whereis won't show useful data, since they do not use the same rules for finding the files as tcsh.
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I'd use strace to capture the whole session, and pick up the keyboard-read by browsing the script output, and then find all of the open-calls after that. That works with Linux and some other systems. There's a similar trace for BSD's (MacOS is a different story though).
However, tcsh likely is not opening the files but listing them from the directory. strace would help with that, too. For instance, in a quick check I see it opening the current directory using openat
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
and then using the lstat function to determine what the entries of interest are (so that it can sort them, decide which are files versus directories, etc):
lstat("xterm.desktop", 0444, st_size=1921, ...) = 0
The "." is the current directory. The program reads a list of directory entries which may be files, directories, symbolic links, etc., but those are not sorted (and types are unknown, until it uses stat/lstat to ask).
locate and whereis won't show useful data, since they do not use the same rules for finding the files as tcsh.
I'd use strace to capture the whole session, and pick up the keyboard-read by browsing the script output, and then find all of the open-calls after that. That works with Linux and some other systems. There's a similar trace for BSD's (MacOS is a different story though).
However, tcsh likely is not opening the files but listing them from the directory. strace would help with that, too. For instance, in a quick check I see it opening the current directory using openat
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
and then using the lstat function to determine what the entries of interest are (so that it can sort them, decide which are files versus directories, etc):
lstat("xterm.desktop", 0444, st_size=1921, ...) = 0
The "." is the current directory. The program reads a list of directory entries which may be files, directories, symbolic links, etc., but those are not sorted (and types are unknown, until it uses stat/lstat to ask).
locate and whereis won't show useful data, since they do not use the same rules for finding the files as tcsh.
edited Sep 13 at 8:45
answered Sep 13 at 1:39
Thomas Dickey
50.3k587157
50.3k587157
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
add a comment |Â
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
Okay, so I found the spot in strace when tab completed the word. I typed echot and it was completed to echotc. However, I cannot discern what files were accessed in the process. The only open command that I see inbetween is " openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 ".
â Alexander Wolf
Sep 13 at 3:24
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
st_mode is just telling me the file type and mode? Can I get further information on which files were actually consulted to excute TAB complete properly, after tcsh used lstat?
â Alexander Wolf
Sep 13 at 19:11
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
You could read tcsh's source-code. Offhand, the reason why it does the lstat's is to determine which entries it can show. Assume it showed all of those for which the lstat was performed.
â Thomas Dickey
Sep 13 at 19:49
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f468678%2fhow-can-i-find-exactly-which-files-have-been-accessed-after-a-command-runs-in-tc%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password