Locating a script that you don't know the name of in Linux
-
I'm trying to find a script someone made a long time ago that is run manually and I'm not sure where to begin because I don't know the name of it. Any advice?
-
@wirestyle22 is this script on a linux system or something from like github?
Are you trying to search locally on some system you specifically have access too or the internet? What does the script do?
-
does the
history
command help you at all? -
If you know who the last person to run it was, maybe in their bash history
Sounds like the definition of a needle in a haystack. If you know what the script does it might be simpler to re-write it depending on how complex it is.
-
find / -name *.sh 2>/dev/null
? -
@black3dynamite said in Locating a script that you don't know the name of in Linux:
find / -name *.sh 2>/dev/null
?If the name ends in .sh. Often they don't.
-
It could end in
.py
or any other extension. -
@DustinB3403 Searching locally. One script removes certain tables from a database in order to disable e-mail notification during a scheduled restore and the other adds the tables back to the database after the restore has been completed.
-
@coliver No unfortunately.
-
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
-
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
The problem is that I can't. They are local accounts and there was no transfer of information. No one knows the passwords. Can't reach out to these people as they left on bad terms apparently.
Very inconvenient
-
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
The problem is that I can't. They are local accounts and there was no transfer of information. No one knows the passwords. Can't reach out to these people as they left on bad terms apparently.
Very inconvenient
So someone left / was termed?
su root
sudo passwd [login] [new pass]
-
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
The problem is that I can't. They are local accounts and there was no transfer of information. No one knows the passwords. Can't reach out to these people as they left on bad terms apparently.
Very inconvenient
So someone left / was termed?
su root
sudo passwd [login] [new pass]
That's what I was thinking.
-
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
Can't reach out to these people as they left on bad terms apparently.
Yeah, okay, so login as root and change the user password. Why would it matter if you have to access their account now? The business gives you permission, right?
-
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
The problem is that I can't. They are local accounts and there was no transfer of information. No one knows the passwords. Can't reach out to these people as they left on bad terms apparently.
Very inconvenient
You can do something like this:
find /home/ -name .bash_history 2>/dev/null | cat .bash_history
-
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
It could end in
.py
or any other extension.Or very likely, no extension at all. Most of mine don't have one.
-
@scottalanmiller said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
It could end in
.py
or any other extension.Or very likely, no extension at all. Most of mine don't have one.
I create my own extensions for labeling purposes
-
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
The problem is that I can't. They are local accounts and there was no transfer of information. No one knows the passwords. Can't reach out to these people as they left on bad terms apparently.
Very inconvenient
The admin can just reset passwords or log in as people. There is never a need to know the local user account passwords (and that goes for Windows, too.)
-
@scottalanmiller said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
It could end in
.py
or any other extension.Or very likely, no extension at all. Most of mine don't have one.
Doesn't that just make it annoying to run a script without knowing what language it was written in? (not that an extension is any indicator of the language used, but still).
-
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@DustinB3403 said in Locating a script that you don't know the name of in Linux:
@wirestyle22 said in Locating a script that you don't know the name of in Linux:
@coliver No unfortunately.
Are there additional users on this system? If so you might need to login as them and check the history for each of them.
The problem is that I can't. They are local accounts and there was no transfer of information. No one knows the passwords. Can't reach out to these people as they left on bad terms apparently.
Very inconvenient
So someone left / was termed?
su root
sudo passwd [login] [new pass]
Even easier...
sudo -i su username