Skip to content

Instantly share code, notes, and snippets.

@raikel
Last active February 12, 2025 17:31
Show Gist options
  • Select an option

  • Save raikel/b0b30af709331218a536b413cb3042d3 to your computer and use it in GitHub Desktop.

Select an option

Save raikel/b0b30af709331218a536b413cb3042d3 to your computer and use it in GitHub Desktop.
Useful Linux commands
# List proccess
ps aux

# journalctl logs
journalctl -u clinic_server.service --since "1 hour ago"
journalctl -u clinic_server.service --since "2 days ago"

# Find text in files in current dir recursively
grep -Ril "a_word" . --include \*.txt --exclude \*.ano --exclude-dir=site-packages

--include \*.cpp

# Find files by name
find /etc -name "*word*"
find /etc -type d -name "*word*"  # only directory
find /etc -name "*word*" -not -path "./directory/*"  # exclude path pattern
find . -name "*word*" -printf "%p %TY-%Tm-%Td %TH:%TM\n" # show modified time
find . -name "*word*" -printf "%T@ %Tc %p\n" | sort -n # show and sort by modified time

# Find sshd sessions
netstat -tnpa | grep ssd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment