.htaccesstop
NGINX #check feature exists which htpasswd #Create password (-c means and file) in any dir you want under root - You will be prompted for the password htpasswd -c /etc/nginx/.htpasswd username # create file htpasswd /etc/nginx/.htpasswd username # don't create file #Delete password in a password file htpasswd -D /etc/nginx/.htpasswd username -- More -- https://www.howtoforge.com/basic-http-authentication-with-nginx http://kbeezie.com/protecting-folders-with-nginx/
Apachetop
Taken from: https://help.ubuntu.com/lts/serverguide/httpd.html http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride Apache2 is configured by placing directives in plain text configuration files. These directives are separated between the following files and directories: apache2.conf: the main Apache2 configuration file. Contains settings that are global to Apache2. httpd.conf: historically the main Apache2 configuration file, named after the httpd daemon. Now the file does not exist. In older versions of Ubuntu the file might be present, but empty, as all configuration options have been moved to the below referenced directories. conf-available: this directory contains available configuration files. All files that were previously in /etc/apache2/conf.d should be moved to /etc/apache2/conf-available. conf-enabled: holds symlinks to the files in /etc/apache2/conf-available. When a configuration file is symlinked, it will be enabled the next time apache2 is restarted. envvars: file where Apache2 environment variables are set. mods-available: this directory contains configuration files to both load modules and configure them. Not all modules will have specific configuration files, however. mods-enabled: holds symlinks to the files in /etc/apache2/mods-available. When a module configuration file is symlinked it will be enabled the next time apache2 is restarted. ports.conf: houses the directives that determine which TCP ports Apache2 is listening on. sites-available: this directory has configuration files for Apache2 Virtual Hosts. Virtual Hosts allow Apache2 to be configured for multiple sites that have separate configurations. sites-enabled: like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sites-available directory. Similarly when a configuration file in sites-available is symlinked, the site configured by it will be active once Apache2 is restarted. magic: instructions for determining MIME type based on the first few bytes of a file. In addition, other configuration files may be added using the Include directive, and wildcards can be used to include many configuration files. Any directive may be placed in any of these configuration files. Changes to the main configuration files are only recognised by Apache2 when it is started or restarted. The server also reads a file containing mime document types; the filename is set by the TypesConfig directive, typically via /etc/apache2/mods-available/mime.conf, which might also include additions and overrides, and is /etc/mime.types by default.
awktop
# $5 is 5th element divided by spaces awk '{print $5}' /var/log/nginx/access.log | sort | uniq -c | sort -nr # uniquie IP Address (https://www.petefreitag.com/item/884.cfm) Listing top 20 Unique grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" access.log | sort | uniq -c | sort -nr | head -n 20
bashrctop
export PS1='\n\h:\w \$ ' alias lsa='ls -lah' alias rm='rm -i' alias gst='git status' alias gbr='git branch' alias ll='ls -lah --time-style="+%a %e %b %Y" --color=auto' alias rm='rm -i' alias goprivate='cd /usr/share/nginx/private' alias gohtml='cd /usr/share/nginx/html' alias gonginx='cd /etc/nginx'
brewtop
# Brew common
brew services list # what's running
brew list # list all packages installed
brew services (start|stop) XXX
brew install XXX
brew uninstall XXX
brew link XXX
brew unlink XXX
brew doctor
brew update
brew cleanup
# Taps
brew tap # list tapped repositories
brew tap <tapname> # add tap
brew untap <tapname> # remove a tap
# INSTALLING
1) brew info mysql # see what will be installed
2) brew install mysql
# PHP
which php
# Add PHP binary to PATH in .bash_profile
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
CentOStop
# Check version rpm --query centos-release
chmodtop
Change file permissions
OCTAL MODE chmod 775 file 4 Read 2 Write 1 Execute in order owner group other 421 421 421 rwx rwx rwx NOTE: add numbers for permission you want for each group SYMBOLIC MODE chmod who op permission file chmod g+r file chmod u+x, go-r file who u User or owner of file g Group to which file belongs o Others outside owner and group a All of the above op = Set permissions - Remove access + Give access permission r Read w Write x Execute Recursively chmod only directories find . -type d -exec chmod 755 {} \; Similarly, recursively set the execute bit on every directory chmod -R a+X * The +X flag sets the execute bit on directories only Recursively chmod only files find . -type f -exec chmod 644 {} \; Recursively chmod only PHP files (with extension .php) find . -type f -name '*.php' -exec chmod 644 {} \;
Command-line syntaxtop
$ command [options(s)] [arguments[s]] command - executable options - modify executable (how command runs) argument - file or directory including path (default path is current dir) # Run last command with sudo sudo !! # Erase to end of line COMMAND K # Erase to beginning of line COMMAND U # Patse what was just erased with CTRL U COMMAND Y # Select a complete file path CMD SHIFT Double CLick # Select a rectangular block Option key and drag to select text # Paste selection CMD SHIFT V # Find CTRL F # FIND NEXT CTRL G || CTRL SHIFT G BOOKMARKS # Insert bookmark Option-Shift-Command-M # Jump to previous bookmark Command-Up Arrow Ctrl + A: go to the beginning of line Ctrl + E: go to the end of line Alt + B: skip one word backward Alt + F: skip one word forward Ctrl + U: delete to the beginning of line Ctrl + K: delete to the end of line Alt + D: delete to the end of word
Control characterstop
Control-s Stops screen output Control-q Resumes screen output Control-c Interrupts current activity Control-d Indicates end-of-file or exit Control-u Erase command line Control-w erase last word on commant line
converttop
create pdf from jpg
convert blah_1.jpg blah_1.pdf or multiple images to one PDF convert blah_* file.pdf convert -density 300x300 -quality 50 -compress jpeg myFiles*.JPG output.pdf convert -density 300x300 -quality 30 -compress jpeg SC* output.pdf A4 convert -density 150x150 -resize 1240x1753 -units PixelsPerInch -repage a4 -compress jpeg myimage.JPG myimage.pdf -page or -repage pending on system
cptop
copy files and directories
cp source_file destination_file -i prompts if you are about to overwright existing file when copying directories, use -r option to copy all recursive directories and files
cron tabtop
0 3 * * * /root/backup.sh >/dev/null 2>&1
# edit crontab
crontab -e
edit like VIM
#save crontab
esc :wq
MAILTO="[email protected]"
0 * * * * php /home/eltreno/tmp/eltreno.php >/dev/null 2>&1
# List all your cron jobs
crontab -l
crontab -u username -l
# Logs
tail -200 /var/log/cron
# BACKUP crontab for user "username"
crontab -u username -l >crontab_backups.txt
crontab -l >crontab_backups.txt
# Delete the current cron jobs for your own user
crontab -r
# Delete job for specific user. Must be run as root user
crontab -r -u username
#Special string Meaning
@rebootRun once, at startup.
@yearlyRun once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
@hourly /path/to/ntpdate
difftop
Display actual differences in files
diff file1 file 2 -i ignore case differences -c show listings of differences with 3 lines of context -E ignore tab expansion -b ignore white space differences -w ignore all white space -B ibgnore changes whose lines are blank -q only output whether files differ -r recursive diff -qr -exclude=.* Dir1 Dir2 # local to remote Diff vimdiff localfile.txt scp://user@host///home/someone/www/remotefile.txt OR ssh user@host "cat /home/user/www/remotefile.txt" | diff - localfile.txt OR diff localfile.txt <(ssh user@host 'cat /home/user/www/remotefile.txt')
Directory sizetop
du -h du -sh *
Dockertop
https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes docker --help IMAGES --> CONTAINERS # list images docker images docker run -ti ubuntu:latest bash docker run --rm -ti ubuntu:latest bash (remove after exiting) # delete images docker rmi Image [ more images space separated ] # check for dangling (unrequried images) docker images -f dangling=true #remore dangling images docker rmi $(docker images -f dangling=true -q) #delete all images docker rmi $(docker images -q) # Create a new image from a container v1) docker commit c745734826b new-image-name (create image from container [c745734826b is container ID] ) docker tag 18eu9843hj245v45jh346v34iu56uh34b56ouhb3456 my-new-image-name v2) simple version docker commit happy_tortis my-new-image-name #list containers docker ps (running containers) docker ps -a (running and exited containers) # remove all exited containers docker rm -v $(docker ps -a -q -f status=exited) # kill all running containers docker kill $(docker ps -aq) docker start fd8df03ab91e192a06e630a688ff065e973d7f0406a0030a8763b5d8288ef609 (start a exited container) docker attach some_name (attach to a running container) # build and start container docker build -t newImageName . OR sudo docker build -t newImageName /path/to/dockerfirdir/ docker run -it -p 8080:80 -v /path/to/local/mount/folder/:/var/www/html imageName # connect a second process to a running container docker exec -ti container_name bash (run a command within a container from outside of it) docker kill container_name docker rm continer_name docker-machine start docker-machine stop docker-machine ip docker-machine ssh docker-machine scp (copy to & from virtual machine) docker-machine upgrade (update docker in your virtual machine) docker-machine restart ### Networking between containers expose ports and link containers # Expose a port # term 1 docker run --rm -ti -p 45678:45678 -p 45679:45679 --name echo_server ubuntu bash nc -lp 45678 | nc -lp 45679 (netcat) #term 2 -> find IP of docker machine on mac (docker-machine ip not working) docker inspect echo_server nc 192.912.912.219 45678 (connect to port) # docker builds docker build -t name-your-image . (current Dir) docker build -f /path/to/a/Dockerfile . # Tips Don't let container expect dependencies when they start, something may become missing one day # Can't install on docker #It is because there is no package cache in the image, you need to run: apt-get -qq update #Or if your command is in a "Dockerfile" itself, you'll then need: apt-get -qq -y install curl Ethernet: move "frames" on wires IP layer: move packets on local network Routing: forwards packets between networks Ports: address particular programs on a computer NETWORKING Make request from Docker container to MAC Host: USE: docker.for.mac.localhost See: https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
findtop
Find files
find path expression [action] find /dir -name '*.htm' find /dir -name filename find /dir -mtime +30 find /dir -size +400 -name filename -type filetype -mtime [+|-]n (n is num of days) -inum n (inode number) -user loginid (files owned by loginid) -use UID -perm mode (file with mode permissions -size [+|-]n (file who match, larger or smaller then) If more then one expressions 'and' is defaut -o makes search 'or'
greptop
Search for string in a file
grep [options(s)] string filename -i ignore case -v search for lines that do not match string grep 'mystring' filename ls -la | grep -i 'apr 30' Multiple words http://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/ In this example, search warning, error, and critical words in a text log $ grep 'warning\|error\|critical' /var/log/messages To just match words, add -w swith: $ grep -w 'warning\|error\|critical' /var/log/messages egrep command can skip the above syntax and use the following syntax: $ egrep -w 'warning|error|critical' /var/log/messages I recommend that you pass the -i (ignore case) and --color option as follows: $ egrep -wi --color 'warning|error|critical' /var/log/messages Find occurrences of something per minute $ grep <something> access.log | cut -c2-18 | uniq -c Find occurrences of something per date grep "11/Jan/2019:07:55" access.log | grep -c <something> # PERL reg ex grep grep -P "(?<=\[')[^,]*" data.txt Add the -o switch so that grep only returns what matches the pattern you're grepping for: grep -Po "(?<=\[')[^,]*" data.txt
gzip gunziptop
gzip filename gunzip filename.gz gunzip - l filename.gz lists compressed file names in zip
headtop
display top (n) lines of text files
head filename (by default displays first 10 lines) head -7 filname (displays first 7 lines)
imagemagictop
Batch resize and rename for i in $( ls *.jpg); do convert -resize 50% $i re_$i; done The command above will resize all images to half of its original size. New resized images will be saved with a prefix "re_". It is also possible to resize all images and at the same time convert them to gif format: for i in $( ls *.jpg); do convert -resize 50% $i $i.gif; done From: http://forum.linuxcareer.com/threads/ 1644-Batch-image-resize-using-linux-command-line
lntop
HARD LINK ln sourcefile targetfile SYMBOLIC LINK ln -s sourcefile targetfile
logstop
sort logs
Sort log by timestamp sort -k1 original.log > new.log reversed add -r sort -k1 -r original.log > new.log
lstop
list directory content
ls (lists files and directories) options: -a all -A all with . and .. -c sort by ctime, inode change time (NOT creation time!) -d list directories -h human readable size (when size called) -l long listing format - F show file types Symbols are as follows: Directory / Executable * Plain text file/ASCII (none) Symbolic link @ -r reverse -R recursive -s size -S sort by file size -t sort by modification time -U do not sort; list entries in dir order -u access time with -lt: sort by, and show, access time with -l: show access time and sort by name otherwise: sort by access time -X sort alphabetically by entry extension -1 list one file per line ## Count files in DIR ## ls -1 | wc -l Which means: ls: list files in dir -1: only one entry per line. Change it to -1a if you want hidden files too | : pipe output onto... wc: "wordcount" -l: count lines.
Mac Encrypted drivetop
1. Go to disc utility 2. Create new image 3. Name it 4. Set size 5 GB 5. Format: Mac OS Extended (Case-sensative, Journaled) 6. Encrypted - Select your option 7. Partition - Singel Partition - GUID Partition Map 8. Image Format - sparse bundle disk image This will create a image_name.sparsebundle files where you save it Double click this to mount and use it from /Volumes/image_name # If it won't eject search for: lsof +D /Volumes/TRENT
mantop
Find information for commands
$ man grep Scrolling in man pages: Spacebar - Scroll through a manual page one screen at a time Return - Scroll through a amanual page one line at a time b - Move back on screen f - Move forward one screen q - Quit from man /string - Search forward for string n - Find next occurrence of string N - Find previous occurence of string
max_upload_sizetop
MAX UPLOAD FILE SIZE Change in Nginx config Add following line to http{..} block in nginx config: http { #... client_max_body_size 100m; #... } Note: For very large files, you may need to change value of client_body_timeout parameter. Default is 60s. Reload PHP-FPM & Nginx service php5-fpm reload service nginx reload
metacharacterstop
Metacharacters are keyboard characters with special meaning to the shell
; [ ] ! ? $ ~ * % < > | * wildcard, 0 or more characters ? any single character [] match a range of characters ; used to seperate multiple commands on a single line
moretop
Display text file one screen at a time
more filename Note: has same scrolling commands as Man (see above)
mvtop
Move and Rename files and directories
mv source_file destination_file -i prompts if you are about to overwright existing file
mysqldumptop
EXPORT mysqldump -uUSER -p --single-transaction --quick DATABASENAME > FILENAME.sql mysqldump -uUSER -p --single-transaction --quick DATABASENAME | gzip > FILENAME.sql.gz mysqldump -uUSER -p --single-transaction --quick DATABASENAME | gzip > `date -I`. FILENAME. SQL. gz IMPORT cat FILENAME.sql | mysql -uUSER -p DATABASENAME gzip -dc < FILENAME.sql.gz | mysql -uUSER -p DATABASENAME
netstatstop
lsof -i netstat -lptu netstat -tulpn yum --security check-update All IPs on port 80 netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1 Highest recent IP requests on port 80 netstat -tn 2>/dev/null | grep ':80[[:space:]]' | awk '{print $5}' | cut -f1 -d: | sort | uniq -c | sort -rn | head Count post 80 requests netstat -n -p|grep SYN_REC | wc -l from: http://linuxaria.com/howto/how-to-verify-ddos -attack-with-netstat-command-on-linux-terminal netstat -na This display all active Internet connections to the server and only established connections are included. netstat -an | grep :80 | sort Show only active Internet connections to the server on port 80, this is the http port and so it's useful if you have a web server, and sort the results. Useful in detecting a single flood by allowing you to recognize many connections coming from one IP. netstat -n -p|grep SYN_REC | wc -l This command is useful to find out how many active SYNC_REC are occurring on the server. The number should be pretty low, preferably less than 5. On DoS attack incidents or mail bombs, the number can jump to pretty high. However, the value always depends on system, so a high value may be average on another server. netstat -n -p | grep SYN_REC | sort -u List out the all IP addresses involved instead of just count. netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}' List all the unique IP addresses of the node that are sending SYN_REC connection status. netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n Use netstat command to calculate and count the number of connections each IP address makes to the server. netstat -anp |grep 'tcp|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n List count of number of connections the IPs are connected to the server using TCP or UDP protocol. netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr Check on ESTABLISHED connections instead of all connections, and displays the connections count for each IP. netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1 Show and list IP address and its connection count that connect to port 80 on the server. Port 80 is used mainly by HTTP web page request. netstat -nlp You want to see if something is listening on some port. netstat -an | grep <portnumber> lsof -i:<portnumber> To see if the port is being used, and what is using it.
Path shortcutstop
used with cd, ls, mv, cp, pwd etc
. (current dir) .. (parent dir) ~ (users home dir) ~loginname (loginname's home dit)
PHP instancestop
# Count established php instances netstat -an | grep 443 | grep ESTABLISHED | wc -l # Which linux OS cat /etc/os-release # How many Cores cat /proc/cpuinfo # NGINX Processes ps -ax | grep nginx # check apache sudo service apache2 status OR which httpd
php-fmptop
# Check average memory usage # rss column is average mem in KB ps -ylC php-fpm --sort:rss OR ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"Mb") }' #How many cores the server has echo Cores = $(( $(lscpu | awk '/^Socket/{ print $2 }') * $(lscpu | awk '/^Core/{ print $4 }') )) #FPM error logs tail -f /var/log/php-fpm/error.log
phpdoctop
phpdoc -o HTML:frames:earthli -f index.php -t targetdir phpdoc -o HTML:frames:earthli -f index.php -t targetdir phpdoc -o HTML:frames:earthli -d dir -t /var/private/project/docs
postfix TLStop
# /etc/postfix/main.cf # Add at the bottom smtpd_tls_cert_file=/etc/ssl/virtualhosts/YOUR_CERT_NAME.crt smtpd_tls_key_file=/etc/ssl/virtualhosts/YOUR_CERT_KEY.key smtp_use_tls=yes smtp_tls_CApath=/etc/ssl/certs smtpd_tls_session_cache_database=btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database=btree:${data_directory}/smtp_scache smtpd_tls_security_level = may smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 smtpd_tls_security_level = encrypt # Preferred syntax with Postfix ? 3.6: smtpd_tls_mandatory_protocols = >=TLSv1.2 # Legacy syntax: smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
recursive grep by file extensiontop
recursive grep by file type
find . -name "*.php" -exec grep -H "search-string" {} \;
redirectiontop
Send command output to file rather then screen
command > file (redirect output of command to a file) command < file (redirect input to command line from file) command 2> file (redirect errorfrom command to to file)
remove .DS_STOREtop
cd dir find . -name '*.DS_Store' -type f -delete
rmtop
Remove files and directories
remove file rm filename (remove filename) remove directory rm -r directory (remove directory and all it's contents) -i prompts for a conformation 'y' for every deletion useful when doing rm * //find and remove files at same time find / -name \*.log -exec rm {} \; //find and remove files while prompting find / -name \*.log -ok rm {} \;
rmdirtop
remove directories
rmdir directoryname only removes empty directories Use rm -r directoryname to remove non-empty directories and ALL it's contents
rsynctop
remove n option when check files and ready to run REMOTE GET data to this server rsync -e ssh -avzn [email protected]:/path/to/src/ /destination/folder/ PUT data on that server rsync -e ssh -avzn /src/folder/ [email protected]:/destination/folder/ LOCAL rsync -avzn --exclude 'folder' --exclude '.*' /src /destination Rsync timestamps only when files are the same rsync -vrt --size-only /src /dest
scptop
scp origon destination scp -P xxx origon destination scp -r origon destination (recursive)
screentop
using screen unix simple commands
Type screen to start a session Do what you need in that screen To leave it running and leave screen? Type CTRL > a Then just type d To view screen available Type screen -ls To go into a screen Type screen -r 15819 where 15819 is number of screen you want to enter
SSH Keystop
How to create ssh keys
Create cd ~/.ssh/ ssh-keygen -t rsa Add public key to remote server cat ~/.ssh/id_dsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys' See also: https://www.digitalocean.com/community/questions/ssh-refused-sshd-2444-userauth_pubkey-key-type-ssh-dss-not-in-pubkeyacceptedkeytypes-preauth
svntop
svnadmin create /path/to/repository svnadmin import srcfolder /path/to/repository svn checkout /path/to/repository src/folder svn commit -m "message" /path svn add * (add all item in folder recurse) svn add --force * (Force all recursive add) svn add itemname (add recures if itemname is a folder) svn move foo.c bar.c svn delete file (remove from repositry) svn update /path - update working copy from repository svn log /path svn blame filename svn status svn help cheatsheet eltreno.com/img/svn.png svn status: Remove files from SVN base that have been deleted fro working dirs:- svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % The first column indicates that an item was added, deleted, or otherwise changed. ' ' No modifications. 'A' Item is scheduled for Addition. 'D' Item is scheduled for Deletion. 'M' Item has been modified. 'C' Item is in conflict with updates received from the repository. 'X' Item is related to an externals definition. 'I' Item is being ignored (e.g. with the svn:ignore property). '?' Item is not under version control. '!' Item is missing (e.g. you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted). '~' Item is versioned as a directory, but has been replaced by a file, or vice versa. The second column tells the status of a file's or directory's properties. ' ' No modifications. 'M' Properties for this item have been modified. 'C' Properties for this item are in conflict with property updates received from the repository. The third column is populated only if the working copy directory is locked. ' ' Item is not locked. 'L' Item is locked. The fourth column is populated only if the item is scheduled for addition-with-history. ' ' No history scheduled with commit. '+' History scheduled with commit. The fifth column is populated only if the item is switched relative to its parent (see the section called “Switching a Working Copy”). ' ' Item is a child of its parent directory. 'S' Item is switched. The out-of-date information appears in the eighth column (only if you pass the --show-updates switch). ' ' The item in your working copy is up-to-date. '*' A newer revision of the item exists on the server.
tailtop
show last (n) lines of file
tail filename (by default shows last 10 lines of file) tail -7 filename (show last 7 lines of file) tail -vf error.log | grep -v Xdebug
teetop
Create content in file, from command line
New file tee filename (create new file) each new line then adds content to file exit with Control-d Existing file tee filename (appends to end of file) each new line then adds content to end of file exit with Control-d
TLStop
#Check Version support openssl s_client -connect example.com:443 -tls1 openssl s_client -connect example.com:443 -tls1_1 openssl s_client -connect example.com:443 -tls1_2
ubuntu remove old kernalstop
**** To list all installed kernels, run: **** dpkg -l linux-image-\* | grep ^ii **** View kernales not being used **** kernelver=$(uname -r | sed -r 's/-[a-z]+//') dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver **** current kernal **** uname -a 1) Remove unused kernals sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')") 2) sudo apt-get autoremove
verisontop
cat /etc/*-release
wctop
Display line, word, byte or character count of file
wc filename by default shows, in order the following newlines words bytes filename options: -c Count bytes -m Count characters -l Count newlines -L Count length of longest line -w Count words
ziptop
Zip file/s zip newzipfilename filetozip1 filetozip2 Zip Directories To include the contents of a directory or directories in a zip archive, use the -r flag: zip -r newzipfilename directorytozip Replace directory with the name of the directory you want to include. This will create the archive filename.zip that contains the files and subdirectories of directory. unzip filename Password protection use -e # Or to unzip diff format password protected files brew install p7zip 7z -P file-to-unzip #unzip 7za x file.zip ############################ ### For Mac Pasword Protected ### -Single file zip -e filename.zip file-to-zip.xxx -mulitple files zip -er files.zip /directory/ unzip file.zip