• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Linux, Bash: ./?

mikeshn

Senior member
I always wanted to ask: Why some commands I must start as ./command and some just command?

I think that if I type just command it should be in my path when I type ./command not in my path. Correct?

Example:

[root@localhost sbin]# ./iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Lokkit-0-50-INPUT all -- anywhere anywhere

[root@localhost sbin]# iptables -L
bash: iptables: command not found
[root@localhost sbin]#


./iptables -> works
iptables -> error

Thanks
M.S.
 
. is the current directory. So ./command is the command in the current working directory, where as the shell would look through your $PATH (in order) and execute the first command (the command you typed in, not just any command 😉) it finds. If you have . in your $PATH you should be fine, unless there is a command with the same name earlier in your $PATH.
 
If you have . in your $PATH

Some people consider this a security vulnerability. In and of itself its not, but when combined with some social enginiering it is often used it a local-attack. Of course this probably isn't that big a deal especially if you don't have lots of users on your system, but just for good measure at least make sure to keep "." out of root's path.

bart
 
Originally posted by: Buddha Bart
If you have . in your $PATH

Some people consider this a security vulnerability. In and of itself its not, but when combined with some social enginiering it is often used it a local-attack. Of course this probably isn't that big a deal especially if you don't have lots of users on your system, but just for good measure at least make sure to keep "." out of root's path.

bart

I actually have . in root's $PATH. It rarely gets used though, because I am fairly used to using the ./.
 
Back
Top