Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 022010
 

Check the exit status of a command

Answer:

You can check the exit status of a command by checking the special variable $?

E.g.

# ls
# echo $?
0

# foo
-bash: foo: command not found

# echo $?
127

Non zero (e.g. 127) exit status mean the command failed to execute.

Jan 312010
 

How to check failed login attempt in Ubuntu

Answer:

Every login attempts are logged in the file /var/log/auth.log in Ubuntu.

To check failed login attempt(s),

E.g.

# grep 'Failed password' /var/log/auth.log

Jan 31 14:00:27 localhost sshd[16141]: Failed password...
Jan 31 14:00:46 localhost sshd[16141]: Failed password...
Jan 31 14:00:49 localhost sshd[16141]: Failed password...