Skip to content

Instantly share code, notes, and snippets.

@zoonderkins
Last active April 1, 2019 10:17
Show Gist options
  • Save zoonderkins/6e0995e6af49bc7403e854133f33133b to your computer and use it in GitHub Desktop.
Save zoonderkins/6e0995e6af49bc7403e854133f33133b to your computer and use it in GitHub Desktop.
Common linux cmd #linux

Find file

grep -rnw 'rpz1.blacklist' -e 'uxip.meizu.com'

Check pid

top -p pid or top | grep dnsdist

PID Info

Get pid cpu, mem data

ps -p <pid> -o %cpu,%mem,cmd ps -C chrome -o %cpu,%mem,cmd htop -p <pid>

Time

Change time zone

dpkg-reconfigure tzdata

Language

# Problem: perl: warning: Falling back to a fallback locale ("en_US.UTF-8")
// Answer
locale-gen
dpkg-reconfigure locales

systemd-journald

To control running services with systemd, use the systemctl utility. This utility is similar to the service utility provided by SysVinit and Upstart. Among others:

systemctl status systemd-journald indicates whether the service is running and additional information if it is.
systemctl start systemd-journald starts the service (systemd unit).
systemctl stop systemd-journald stops the service.
systemctl restart systemd-journald restarts the service.
systemctl reload systemd-journald reloads the service's configuration if possible, but will not kill it (so no risk of a service interruption or of disrupting processing in progress, but the service may keep running with a stale configuration).
systemctl force-reload systemd-journald reloads the service's configuration if possible, and if not restarts the service (so the service is guaranteed to use the current configuration, but this may interrupt something).
systemctl daemon-reload reloads systemd's own configuration.

Cronjob

// Only for ROOT User
nano /etc/crontab
// Every minit
* * * * * root /root/monitor-kresd.sh
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be execute
// Restart service
service cron restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment