ssh-keygen - is used to generate a public/private authentication key pair
To generate ssh key without any arguments
$ ssh-keygen
To define key type
$ ssh-keygen -t rsa
$ ssh-keygen -t dsa
To define bit size default is 2048
$ ssh-keygen -b 4096
To assign passphrase
$ ssh-keygen -P "myp@ssword"
To change passphrase of the private key
$ ssh-keygen -p
To create keys with custom filename
$ ssh-keygen -f my-rsa-key
To add custom comment to the key
$ ssh-keygen -C "This key is for my.server.in"
To change comment of the key
$ ssh-keygen -c
To hash the content of known_hosts file
$ ssh-keygen -H
To delete all the keys related to 192.168.122.101 host from known_hosts file
$ ssh-keygen -R 192.168.122.101
regards,
T.Dhanasekar
sshd - is the daemon program for ssh
To use either IPv4 or IPv6 only
# /usr/sbin/sshd -4
# /usr/sbin/sshd -6
To display debug modes
# /usr/sbin/sshd -D
# /usr/sbin/sshd -d -d -d
To send the error messages to the standard error
# /usr/sbin/sshd -d -e
To use own config file for sshd apart default /etc/ssh/sshd_config
# /usr/sbin/sshd -f /root/conf/custom_sshd.conf
To customize SSHD grace time
# /usr/sbin/sshd -g 180
To specify options in command line
# /usr/sbin/sshd -o "AllowUsers user3 user4"
regards,
T.Dhanasekar
ssh-copy-id - use locally available keys to authorise logins on a remote
machine
create ssh key
$ ssh-keygen -t rsa
To copy ssh key to remote machine
$ ssh-copy-id -i /home/ilugc/.ssh/id_rsa.pub user(a)192.168.122.101
To enable forced mode to copy ssh key to remote machine
$ ssh-copy-id -f -i /home/dhana/.ssh/id_rsa.pub dhana(a)192.168.122.101
To perform dry-run that prints the keys intended for installation without
installing them on the remote host
$ ssh-copy-id -n -i /home/dhana/.ssh/id_rsa.pub dhana(a)192.168.122.101
To connect to a remote host when the default SSH port is not being used.
$ ssh-copy-id -i -p <custom_port> /home/dhana/.ssh/id_rsa.pub
dhana(a)192.168.122.101
regards,
T.Dhanasekar
ssh-agent - is a program to hold private keys used for public key
authentication
To start the ssh-agent
$ ssh-agent
To stop / kill the ssh-agent
$ ssh-agent -k
To run ssh-agent in debug mode
$ ssh-agent -d
To set bind socket name
$ ssh-agent -a ~/demo-ssh-socket $SHELL
To set expiry time for keys
$ ssh-agent -t 1800 $SHELL
$ ssh-agent -t 10D $SHELL
regards,
T.Dhanasekar
ssh-add - adds private key identities to the OpenSSH authentication agent
To create the public key and the private key
$ ssh-keygen -t rsa
To keep the identity of the agents for 600 seconds.
$ ssh-agent -t 600
To make ssh-agent command for non-interactive authentication
$ eval $(ssh-agent)
To add the private key passphrase to ssh-agent
$ ssh-add
To list my private keys cached by ssh-agent
$ ssh-add -l
To list all public key parameters of all identities
$ ssh-add -L
To remove all cached ssh-agent private keys
$ ssh-add -D
To lock the SSH Agent
$ ssh-add -x
To unlock SSH Agent
$ ssh-add -X
regards,
T.Dhanasekar
ssh - is a program for logging into a remote machine and for executing
commands on a remote machine
To access remote server
$ ssh 192.168.122.50
$ ssh my.server.in
To specify a username for SSH connection
$ ssh username@hostname_or_ip
$ ssh -l username@hostname_or_ip
$ ssh -l user1(a)192.168.122.50
$ ssh -l user1(a)my.server.in
To use a different port number for ssh connection
$ ssh my.server.in -p 2222
$ ssh 192.168.122.50 -p 2222
To run a command on a remote server from a local computer
$ ssh 192.168.122.50 rm ~/Desktop/test_file.txt
To execute multiple commands using SSH on remote nodes
$ ssh 192.168.122.50 command1; command2; command3
To make ssh to use protocol version 2
$ ssh -2 user1(a)192.168.122.50
To Print debug information
$ ssh -v user1(a)192.168.122.50
To increase the level of verbosity
$ ssh -vv user1(a)192.168.122.50
To get more level of verbosity
$ ssh -vvv user1(a)192.168.122.50
To enable X11 forwarding with ssh command
$ ssh -X ip_address
$ ssh -X 192.168.122.50
To hide the error message
$ ssh -q 192.168.122.50
To change any default value to other possible values during ssh
$ ssh -o option=value ip_address
$ ssh -o Port=2222 192.168.122.50
regards,
T.Dhanasekar
ss - is used to dump socket statistics, and to investigate sockets
To list all Connections
$ ss
To list Listening and Non-listening Ports
$ ss -a
To list Listening Sockets
$ ss -l
To list all TCP connections
$ ss -t
To list all listening TCP connections
$ ss -lt
To list all UDP connections
$ ss -ua
To list all listening UDP connections
$ ss -lu
To display PID of sockets
$ ss -p
To display summary statistics
$ ss -s
To display IPv4 and IPv6 socket connections
$ ss -4
$ ss -6
To filter connections by port number
$ ss -at '( dport = :22 or sport = :22 )'
$ ss -at '( dport = :80 or sport = :80 )'
$ ss -at '( dport = :ssh or sport = :ssh )'
$ ss -at '( dport = :http or sport = :http )'
regards,
T.Dhanasekar
Hi Mr Dhanasekar
Nice to e-meet
Are these items of use
I have found 1 man who is gifting them!
@ , motherboard,
cooler,
RAM
, graphics cards
, laptop PSU,
5v 9v 12v power bricks,
modem
What can we use these for ?
Kind regards
@ ukX
Peter Regelous
split - is used to split large files into smaller files
syntax
$ split {options} {file_name} {prefix}
$ cat example.txt
This is line 1
This is line 2
This is line 3
This is line 4
This is line 5
This is line 6
This is line 7
This is line 8
This is line 9
This is line 10
To split example.txt with verbose option
$ split example.txt --verbose
To split files with customize line numbers
$ split -l5 example.txt --verbose
To split files with file size
$ split -b 4 example.txt --verbose (in bytes)
$ split -b 2K <file_name> --verbose (in Kb)
$ split -b 2M <file_name> --verbose (in Mb)
$ split -b 1G <file_name> --verbose (in Gb)
To create Split files with numeric suffix instead of alphabetic
$ split -d example.txt --verbose
x00
To split file with customize suffix
$ split -l5 example.txt ilugc_file
To generate n chunks output files
$ split -n5 <file_name>
To Prevent Zero Size Split output files
$ split -n60 -e example.txt
To create split output files of customize suffix length
$ split -b 4 example.txt -a 3
$ split -b 4 example.txt -a 4
To split ISO file and merge it into a single file
$ split -n5 ubuntu-22.04.iso Split_IS0_
it will split ISO file into 5 pieces
To merge these files into a single
$ cat Split_IS0_a* > ubuntu22.04_new.iso
To verify the integrity of merge file using md5sum
before split of iso
$ md5sum ubuntu22.04.iso
after split and merge
$ md5sum ubuntu22.04_new.iso
regards,
T.Dhanasekar
source - is a built-in shell command that reads and executes the file
content in the current shell.
syntax
$ source [filename] [arguments]
To pass commands and arguments
$ cat example.txt
free -h
pwd
date
time
uptime
$ source example.txt
To read variables from a file
$ cat example.sh
#!/bin/bash
VAR1="a"
VAR2="b"
VAR3="c"
create bash script
$ cat sample.sh
#!/bin/bash
source example.sh
echo "VAR1 is $VAR1"
echo "VAR2 is $VAR2"
echo "VAR3 is $VAR3"
$ source sample.sh
To refresh the current shell environment
$ alias ll = 'ls -l'
$ alias c = 'clear'
$ c
$ ll
This command only works in the current shell session
To make it permanent
$ sudo nano ~/.bashrc
alias ll = 'ls -l'
alias c = 'clear'
:x
Refresh the current shell environment and make it permanent for the user
$ source ~/.bashrc
To make it system wide change
$ sudo vim /etc/profile
alias ll = 'ls -l'
alias c = 'clear'
:x
# source /etc/profile
regards,
T.Dhanasekar