Skip to content

Instantly share code, notes, and snippets.

@phunguyen19
Last active June 10, 2022 14:21
Show Gist options
  • Save phunguyen19/5e9bde714d2ad501eefc72753787abc0 to your computer and use it in GitHub Desktop.
Save phunguyen19/5e9bde714d2ad501eefc72753787abc0 to your computer and use it in GitHub Desktop.
linux useful command
# List all process of program "node"
ps -fe | preg node

# To list any process listening to the port 8080:
lsof -i:8080

# To kill any process listening to the port 8080
kill $(lsof -t -i:8080)
# or more violently:
kill -9 $(lsof -t -i:8080)

# Linux : '\r': command not found . Using this command to trim them
sed -i 's/\r$//' filename

# Enable start default a service
sudo update-rc.d apache2 disable

# Disable start default
sudo update-rc.d nginx enable

# Cron run every 1 minutes, in the case of user transfer
* * * * * curl -m 5 CronUrl

# Export your terminal logs to file
exec > file.txt

# check disk space and also list all disks
df
# -h (human-readable) option for human readable format of disk size
df -h
# more: https://www.geeksforgeeks.org/df-command-in-linux-with-examples/

`free` check free RAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment