buymeasoda RefDocs
  • Overview
  • General
    • Android
    • Apache
    • Fish
    • Git
    • Github
    • Gmail
    • Homebrew
    • iOS
    • iTerm
    • MacOS
    • MacPorts
    • Mamp
    • Media
    • Mercurial
    • MySQL
    • Node
    • npm
    • nvm
    • Obsidian
    • PHP
    • React Native
    • Rust
    • Server
    • Slack
    • Sourcegraph
    • Tools
    • Vim
    • VS Code
    • Yarn
  • Unix
    • Checksum and hash utilities
    • Command line history
    • Command line keyboard shortcuts
    • Compress files and folders
    • Crontab
    • Diff files and folders
    • Disk usage and file sizes
    • Find and search files
    • Firewall configuration
    • Help and manual pages
    • HostName and Local HostName for Mac OSX
    • Navigating the file system
    • Network, domains and routing
    • Run and manage background tasks
    • Secure FTP SFTP and Secure Copy SCP
    • Secure Shell SSH
    • Sync files and folders
    • System and process management
    • System and user information
    • Useful characters
    • Useful commands
    • User, file and group permissions
    • Working with cURL
    • Working with files and directories
    • Working with text
Powered by GitBook
On this page
  • Session
  • Processes
  • Open File Processes
  • Terminal
  • Maintenance
  1. Unix

System and process management

Session

Exit the current terminal session

exit

Shutdown or restart the system

shutdown
reboot

Processes

Kill process you own or created

killall <process-name>

Search for named running process and return process id (-l to include process name)

pgrep -l <process-name>

Kill named process (-l for long output, -f to match against full arguments)

pkill -l <process-name>

Search for process details

ps aux | grep <process-name>

Kill a running process (by id)

kill <process-id>
sudo kill <process-id>

Hangup process

kill -1 <process-id>

Kill process (using force kill signal -9)

kill -9 <process-id>

Open File Processes

List open process IDs for file

fuser <file>

List open files for all processes

lsof

List open files for a user

lsof -u <username>

List processes for a specific file or volume

lsof <file>
lsof <volume>

List open files for internet address processes

lsof -i

Filter internet address listing by port

lsof -i :<port>

Identify processes using a volume (eg. when unable to unmount external drive)

lsof /Volumes/<volume-name>
sudo lsof /Volumes/<volume-name>

Kill process using a volume

kill <process-id>

Terminal

Change Unix shell (enter path to new shell when prompted)

chsh

Output default shell

echo $SHELL

Maintenance

Update package list

sudo apt-get update

Upgrade outdated packages

sudo apt-get upgrade
PreviousSync files and foldersNextSystem and user information

Last updated 2 years ago