ict.ken.be

Delivering solid user friendly software solutions since the dawn of time.

Linux commandline

Categories: Linux

Bash

  • clear : empty console
  • ls -soah : show file details
  • cat filename : show content inline
  • less filename : show content in scrollable way
  • rm -I glob : remove but confirm once
  • mkdir -p : create new folder, ignore if exits
  • top : show processes
  • htop : show processes with colors
  • pstree -p : show which process contains what other process by id
  • kill processid : terminate process
  • df -h : show diskspace
  • reboot : restart the system
  • lsof -i : list open ipv[46] files by process
  • netstat -tulpn : display listening sockets
  • nmap -v 192.168.1.1 : find open ports on gateway
  • nc : networking tool - seeĀ https://en.wikipedia.org/wiki/Netcat
  • dmesg | grep -iC 3 "search item" : find in debug messages
  • curl -L ken.be : show website content inline and follow redirects
  • who : currently logged in users
  • whoami : user that run this command
  • passwd -Sa : show status of all accounts
  • groupadd groupname : create new group
  • useradd -m -g groupname username : create home, add user and assign groupĀ 
  • find / -group groupname : find files owned by group
  • find / -user username : find files owned by user
  • stat -c %U /var/motion/cam1 : show who ownes the folder
  • sudo -u username somecommand : elevate permissions for command
  • chown video:video /var/whatever : change file ownership
  • chmod 755 /var/whatever : change file permissions
  • chmod +x script.sh : add execute permissions to script file