Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:misc [2024-08-02 Fri wk31 19:03] – [pbcopy pbpaste] baumkphome_server:home_server_setup:other_services:misc [2024-09-28 Sat wk39 20:53] (current) – [Grep finds strings] baumkp
Line 195: Line 195:
 Once you're comfortable with using grep to find simple strings as seen above, it can do far more complex tasks. These include but are not limited to: case-insensitive use, more complex patterns (including full regular expressions), exclusion (only show me lines that don't include the pattern), and much, much more. But don't worry about that until after you're familiar with simple grep uses. Once you start, it's truly hard to imagine life without grep anymore! Once you're comfortable with using grep to find simple strings as seen above, it can do far more complex tasks. These include but are not limited to: case-insensitive use, more complex patterns (including full regular expressions), exclusion (only show me lines that don't include the pattern), and much, much more. But don't worry about that until after you're familiar with simple grep uses. Once you start, it's truly hard to imagine life without grep anymore!
  
 +====netstat====
 +  *''netstat -n'' to see active internet connections
 +  *''netstat -ie'' to see kernal interface table
 +  *''netstat -u'' to see status of TCP/IP connections
 +  *''netstat -p'' to see all the active IPv4 connections
 +  *''netstat -a'' to demonstrate the stat of all sockets, TCP and UDP
 +  *''netstat -s'' to see statistical summary for each available protocol
 +  *''netstat -su'' to see statistical summary of UDP
 +  *''netstat -stu'' to see statistical summary of TCP
 +  *''netstat -r'' to kernal route table 
 =====Sed replaces strings===== =====Sed replaces strings=====
  
Line 271: Line 281:
  
 =====pbcopy pbpaste===== =====pbcopy pbpaste=====
 +Also see [[https://wiki.kptree.net/doku.php?id=home_server:home_server_setup:other_services:bash|BASH Customisation]]
 +
 Linux requires the  package xsel, ''sudo apt install xsel'' Linux requires the  package xsel, ''sudo apt install xsel''
 Some raw xsel examples: Some raw xsel examples:
-  *'''%%uname -r | xsel --input --clipboard%%''+  *''%%uname -r | xsel --input --clipboard%%'' pipes the output of the command ''uname -r'' to the clipboard 
 +  *''%%xsel --output --clipboard > file.txt%%'' copies the current clipboard contents to the file file.txt 
 + 
 +To create the command short cuts: 
 +  *''vim ~/.bash_aliases'' and add  the following lines: 
 +    *''%%alias pbcopy='xsel --input --clipboard'%%'' 
 +    *''%%alias pbpaste='xsel --output --clipboard'%%'' 
 +After  adjusting bash setting run ''source ~/.bashrc'' to update configuration 
 + 
 +To function on remote server: 
 +  -Check the above setup on the remote sever 
 +  -Check X11 forwarding is activated: 
 +    - ''cat /etc/ssh/sshd_config | grep X11'',  output should show a line ''X11Frowarding yes'' 
 +    -If not, edit the file to make so, and then run ''sudo systemctl restart ssh'' to update the ssh configuration 
 +  -Lastly, when ssh into system use the -X flag to use X11 forwarding; ''ssh -X 
 + 
 +