Last active
December 27, 2015 15:32
-
-
Save alexandrinos/e755521413d0c6b6fc09 to your computer and use it in GitHub Desktop.
Usefull commands network, environment Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#copy a file using brackets short format | |
cp .bashrc{,.orig} | |
#create multiple files | |
touch /path/to/{file1,file2,file3}.txt | |
#list prefix | |
ls {a,b,c}.txt | |
#list sufix | |
ls *.{txt,doc} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#---Networking | |
# | |
#what process belongs to which port host User Protocol | |
#must run as sudo | |
sudo netstat -tulpne | |
#or short | |
sudo netstat -aupnt | |
#show internet sockets and local sockets splitted | |
sudo netstat -p | |
#---Processes | |
# | |
#what initiated the processes and what PID have | |
ps aux | |
#which ports are open and what process | |
nmap localhost | |
#---Aptitude(Ubuntu) | |
# | |
#short explanation of a software | |
aptitude search nfs | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DEBUG SSH | |
#on server side run; port any free port; d is the level of debug; one is the minimum debug | |
/usr/bin/sshd -ddd -p 2233 | |
#you could use also another configuration file, for testing, like this | |
/usr/sbin/sshd -d -p 2233 -f /home/fred/sshd_config.test | |
#then on client run | |
ssh myuser@192.168.1.2 -vvv -p 2233 | |
#on client you could run to show the config file | |
ssh user@machinde -G -p 2233 | |
#or we can ssh with options only; anything is just an alias | |
ssh -o "User=apollo" -o "Port=4567" -o "HostName=example.com" anything | |
#other usefull commands on server to test the config file -> log user,host and address, | |
#with multiple parameters | |
/usr/bin/sshd -TC user=fred,host=server.example.org,addr=192.0.2.15 | |
#also the localport and address | |
/usr/sbin/sshd -TC user=fred,host=server.example.org,addr=192.0.2.15,laddr=192.0.2.2,lport=2222 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#shows environment of the current user; very usefull for debugging | |
# PATH, user home dir,tty number,mail path, term,shell path,ssh_client number and ports | |
env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#usefull for freezing window, fg jobs, command line binding(forwarding),forwarded connections | |
To use a sequence line: | |
press: | |
Enter | |
then press: | |
~ ? | |
Supported escape sequences: | |
~. - terminate connection (and any multiplexed sessions) | |
~B - send a BREAK to the remote system | |
~C - open a command line | |
~R - request rekey | |
~V/v - decrease/increase verbosity (LogLevel) | |
~^Z - suspend ssh | |
~# - list forwarded connections | |
~& - background ssh (when waiting for connections to terminate) | |
~? - this message | |
~~ - send the escape character by typing it twice | |
(Note that escapes are only recognized immediately after newline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ssh to a remote and use the Gui programs that a remote uses on local machin ! | |
ssh -X remote_host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment