Lists open files and the corresponding processes. Note: Root privileges (or sudo) is required to list files opened by others. More information: https://manned.org/lsof.
- Find the processes that have a given fileopen: lsof path/to/file
- Find the process that opened a local internet port: lsof -i :port
- Only output the process ID (PID): lsof -t path/to/file
- List files opened by the given user: lsof -u username
- List files opened by the given command orprocess: lsof -c process_or_command_name
- List files opened by a specific process, given its PID: lsof -p PID
- List open files in a directory: lsof +D path/to/directory
- Find the process that is listening on a local IPv6 TCP portand don't convert network orport numbers: lsof -i6TCP:port -sTCP:LISTEN -n -P
Schedule cron jobs to run onatimeintervalforthecurrentuser. Job definition format: "(min) (hour) (day_of_month) (month) (day_of_week) command_to_execute". More information: https://manned.org/crontab.
- Edit the crontab fileforthe current user: crontab -e
- Edit the crontab filefora specific user: sudo crontab -e -u user
- Replace the current crontab withthe contents ofthe given file: crontab path/to/file
- View a list of existing cron jobs for current user: crontab -l
- Remove all cron jobs forthe current user: crontab -r
- Sample job which runs at10:00 every day (* means anyvalue): 010 * * * command_to_execute
- Sample job which runs every minute onthe3rdofApril: * * 3 Apr * command_to_execute
- Sample job which runs a certain script at02:30 every Friday: 302 * * Fri /absolute/path/to/script.sh