Unix Commands

 https://devhints.io/bash


 which -- locate a program file in the user's path


 Example: which helm


echo $OLDPWD - OLDPWD holds the location where you were previously


groups - command displays the groups to which current user belongs


umask


chgrp - Change groupname for a file/folder


chown - change owner of a file/folder


find . -mtime 0 - files created in last 24 hours


Iperf - a tool for network performance measurement and tuning.


passwd < username > - change password for the user


workload identity GKE


set -x enables a mode of the shell where all executed commands are printed to the terminal

set +x disables it


df -h


free -m


uptime


iostat


To run a cammand assigned to a variable:


l = ls

$l

--------------------------------------


There are a few shortcuts if you want all of the arguments from the previous command, or just the last argument.


For all of the arguments: <command> !*

For just the last argument: <command> !$


I/O Redirection:


Crontab:

crontab -l

Will list crontab jobs

!! - rerun previous command

crontab -e


rsync -Rrui app/build "$context_dir"


##############################     PARAMETERS  START #######################################################################

getopts

$@ is nearly the same as

$*, both meaning "all command line arguments".

$# = stores the number of arguments

declare


##############################     PARAMETERS   END #######################################################################


##############################     USER MANAGEMENT START   ##################################################################


useradd <username>:

To add a new user


passwd <username>:

To setup a password for the user

##############################     USER MANAGEMENT END   ##################################################################


##############################     STRING START   ##################################################################

realpath - converts filename to absolute path

basename - Strips directory information

dirname - Prints the directory name under which current file/directory is placed

echo ${#var} - echos length of var variable

echo ${var:15:4} - extracts and echos 4 characters starting from index 15

##############################     STRING END   ##################################################################


Crontab -e to schedule a job

crontab -l to list the jobs

crontab -u username -l

crontab -r to remove a job


Comments

Popular posts from this blog

Git Commands

GCP Notes