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
sort - is used to sort a file, arranging the records in a particular order.
$ cat file.txt
assam
tamilnadu
chattisgarh
delhi
gujarat
himachal pradesh
kerala
bihar
To sort arrange the file.txt
$ sort file.txt
To Save Output to File
$ sort file.txt > sorted.txt
To Check for Sorting in File
$ sort -c file.txt
To Sort Multiple Files
$ sort file1.txt file2.txt
To Sort in Reverse Order
$ sort -r file.txt
To Remove Duplicate Entries
$ sort -u file.txt
To Sort by Months
$ ls -l > month.txt
$ sort -Mk6 month.txt
To Randomly Sort Data
$ sort -R sorted.txt
regards,
T.Dhanasekar
snap - is used to install, configure, refresh and remove snaps
$ sudo snap install snap-store
To Install Snap Apps
$ sudo snap install <package_name>
To list Installed snaps
$ snap list
To Search for Snaps
$ snap find <search_term>
To update snaps
$ snap refresh <package_name>
To print which snap packages have available updates
$ sudo snap refresh --list
To downgrade Snaps
$ sudo snap revert <package_name>
To remove Snaps
$ sudo snap remove <package_name>
To remove a snap without generating a snapshot
$ sudo snap remove <package_name> --purge
To Disable Snaps
$ sudo snap disable <package_name>
To Enable a disabled snap
$ sudo snap enable <package_name>
To List All Running Services
$ snap services
To list the services of a single snap
$ snap services <package_name>
To Start, Restart, and Stop Snap Services
$ sudo snap restart <package_name>
$ sudo snap start <service_name>
$ sudo snap stop <package_name>
To prevent a snap service from starting on boot
$ sudo snap stop --disable <service_name>
To make a service to start on next boot
$ sudo snap start --enable <service_name>
To Download and Install Snap Apps Offline
$ snap download <package_name>
To display history of changes made to system
$ snap changes
To change to a different channel
$ sudo snap refresh <package_name> --channel=<channel_name>
$ sudo snap refresh youtube-dl --channel=stable
regards,
T.Dhanasekar
slogin - is an alias for the ssh client, which is used to connect securely
to a remote shell.
To login to a remote server
$ slogin 192.168.122.50
$ slogin user1(a)192.168.122.50
To login to remote server with port
$ slogin -p 22 user1(a)192.168.122.50
To to login as user1 on the remote machine
$ slogin -l user1 192.168.122.50
regards,
T.Dhanasekar
sleep - is used to delay for a fixed amount of time during the execution of
any script
syntax
$ sleep number[suffix]
To make sleep command without any suffix
$ sleep 20s
To display help options
$ sleep --help
$ cat sleep.sh
#!/bin/bash
echo "Waiting for 10 seconds..."
sleep 10
echo "Task Completed"
:x
$ sh sleep.sh
Waiting for 10 seconds...
Task Completed
sleep command in the terminal with other commands
$ ll && sleep 20 && pwd && free -h
regards,
T.Dhanasekar
skill - is used to send signals to users and process
To halt/stop user1
$ skill -STOP -u user1
To resume already halted user1
$ skill -CONT -u user1
To kill and logout user1
$ skill -KILL -u user1
To kill and logout all users
$ skill -KILL -v /dev/pts/*
To stop 3 users user1, user2, user3
$ skill -STOP user1 user2 user3
regards,
T.Dhanasekar