Skip to content

Instantly share code, notes, and snippets.

@DaddyMoe
Last active March 26, 2020 15:45
Show Gist options
  • Save DaddyMoe/83eb1b6dc682e9e5a24bae140eca30fd to your computer and use it in GitHub Desktop.
Save DaddyMoe/83eb1b6dc682e9e5a24bae140eca30fd to your computer and use it in GitHub Desktop.
most use bash commands I never remembers - bash
# check for running java apps
ps xfau | grep java
# Or via program grep for java
pgrep -fl java
# Or via checking for port
lsof -i tcp:80
# Count files in current directory recursively
find . -type f | wc -l
# Count files containing a String pattern
# Search recursively in dir
grep -irl "<dc:type>Dataset</dc:type>" dir | wc -l
# Add user group permission to folder recursively
$ ls -la # Checks current perms
$ sudo chgrp -R my_developers_group ../development_dir
$ sudo chmod -R 2775 development
$ ls -la # Checks new perms
$ sudo chmod -R ug+rwx development # Gives permission for READ, WRITE and EXECUTE recursively to current user and group-name defined
## Explained: source: https://www.tecmint.com/create-a-shared-directory-in-linux/
# 2 – newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set GID bit of the parent directory.
# 7 – gives rwx permissions for owner.
# 7 – gives rwx permissions for group.
# 5 – gives rx permissions for others.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment