- Basic Alias's
- HTTD Service
- Mysql Service
- Uninstalling in Ubuntu
- Mysql Service Alias
- Connecting To Remote nix
- Connecting To Remote nix without password
- Connecting To Remote nix with name ,no need of ip
alias c="clear"; # clear screen alias e="exit"; # exit session
alias hs="sudo service httpd status"; alias ha="sudo service httpd start"; alias hb="sudo service httpd restart"; alias hc="sudo service httpd stop";
alias ms="sudo service mysqld status"; alias ma="sudo service mysqld start"; alias mb="sudo service mysqld restart"; alias mc="sudo service mysqld stop"; alias mysql="sudo mysql";
By usig following commands we can save a file in read-only
1.":w !sudo tee % " 2.Click on 'O' or 'L'
dpkg -l | grep mysql
sudo apt-get remove --purge mysql-server mysql-client mysql-common sudo apt-get autoremove sudo apt-get autoclean
alias ms="sudo service mysqld status"; alias ma="sudo service mysqld start"; alias mb="sudo service mysqld restart"; alias mc="sudo service mysqld stop"; alias mysql="sudo mysql";
sudo apt-get update sudo apt-get install mysql-server-5.5
sudo netstat -tap | grep mysql
| # Checking which systems are up in network | |
| #!/bin/bash | |
| for i in 192.168.0.{1..256}; | |
| do | |
| if ping -c1 -w1 $i &>/dev/null | |
| then | |
| echo $i is up | |
| fi | |
| done |
For Referance : https://help.ubuntu.com/lts/serverguide/firewall.html
First 'ufw' needs to be enabled. From a terminal prompt enter
sudo ufw enable
sudo ufw allow 22
Rules can also be added using a numbered format
sudo ufw insert 1 allow 80
sudo ufw deny 22
To remove a rule, use delete followed by the rule:
sudo ufw delete deny 22
It is also possible to allow access from specific hosts or networks to a port. The following example allows ssh access from host 192.168.0.2 to any ip address on this host:
sudo ufw allow proto tcp from 192.168.0.2 to any port 22
Replace 192.168.0.2 with 192.168.0.0/24 to allow ssh access from the entire subnet.
Adding the --dry-run option to a ufw command will output the resulting rules, but not apply them. For example, the following is what would be applied if opening the HTTP port:
sudo ufw --dry-run allow http
ufw can be disabled by:
sudo ufw disable
To see the firewall status, enter
sudo ufw status
And for more verbose status information use:
sudo ufw status verbose
To view the numbered format:
sudo ufw status numbered
| ## Parent Proccess Kill | |
| pkill -9 -f processname | |
| Ex: pkill -9 -f gedit |
| ## Change the prompt | |
| PS1='\n \u $reset_color→ \w \n \n'; | |
| \n : new line | |
| \u : user name | |
| \w : path | |
| $reset_color→ :To generate right arrow | |
| Example : | |
| 1) lakshman → ~ | |
| 2) lakshman → /var/mail |
| Add “Open as Root/Administrator” Option in Ubuntu 14.10 | |
| sudo add-apt-repository ppa:noobslab/apps | |
| sudo apt-get update | |
| sudo apt-get install open-as-administrator | |
| nautilus -q |
| ## Copy Remote File To Local Machine | |
| scp -r <user>@<hostname>:<file/folder> <destination> | |
| -r : recursively copies files and folders | |
| ex: scp -r root@tv:/var/www/html ./ | |
| ## Copy the file "foobar.txt" from a remote host to the local host | |
| `$ scp [email protected]:foobar.txt /some/local/directory` | |
| ## Copy the file "foobar.txt" from the local host to a remote host | |
| `$ scp foobar.txt [email protected]:/some/remote/directory` | |
| ## Copy the directory "foo" from the local host to a remote host's directory "bar" | |
| `$ scp -r foo [email protected]:/some/remote/directory/bar` | |
| ## Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu" | |
| `$ scp [email protected]:/some/remote/directory/foobar.txt [email protected]:/some/remote/directory/` | |
| ## Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host | |
| `$ scp foo.txt bar.txt [email protected]:~` | |
| ## Copy the file "foobar.txt" from the local host to a remote host using port 2264 | |
| `$ scp -P 2264 foobar.txt [email protected]:/some/remote/directory` | |
| ## Copy multiple files from the remote host to your current directory on the local host | |
| `$ scp [email protected]:/some/remote/directory/\{a,b,c\} .` | |
| `$ scp [email protected]:~/\{foo.txt,bar.txt\} .` |
| Screen Command | |
| KeyBind + Combination Key Action Description | |
| Ctrl+b % Split the current window vertically into two panes | |
| Ctrl+b :split-window Horizontally split window or current pane | |
| Ctrl+b o Switch to the next pane | |
| Ctrl+b c Open new window | |
| Ctrl+b l Move to previous window | |
| Ctrl+b n Move to next window | |
| Ctrl+b p Move to previous window | |
| Ctrl+b d Detach current client | |
| Ctrl+b x Kill the current pane | |
| Ctrl+b & Kill the current window | |
| Ctrl+b , Rename the current window | |
| Ctrl+b q Display pane numbers | |
| Ctrl+b ? List all keybindings | |
| Ctrl+b { Move the current pane to previous | |
| Ctrl+b } Move the current pane to next | |
| Ctrl+b :break-pane Detach pane into its own window | |
| Ctrl+b w List all windows | |
| Ctrl+b 0-9 To select window | |
| Ctrl+b :resize-pane Resize current pane down by default | |
| Ctrl+b :resize-pane -U Upward Resize current pane | |
| Ctrl+b :resize-pane -R Resize current pane to right | |
| Ctrl+b :resize-pane -L Resize current pane to left | |
| Ctrl+b :resize-pane 40 Resize current pane down by 40 cells | |
| Ctrl+b :resize-pane -L 40 Resize current pane left by 40 cells | |
| Ctrl+b :resize-pane -R 40 Resize current pane right by 40 cells | |
| Ctrl+b :resize-pane -U 40 Resize current pane upward by 40 cells | |
| Ctrl+b :resize-pane -t -L 40 Resize pane with id of 2 left by 40 cells | |
| Ctrl+b :resize-pane -t 2 40 Resize pane with id of 2 down by 40 cells |
| ## Connecting to remote nix system | |
| Syntax : ssh user@remote_ip | |
| Ex: ssh [email protected] | |
| ## Connecting to remote nix system without password | |
| 1.Genarate ssh-keygen with typeing this command 'ssh-keygen' and give info like ssh file name and password | |
| Syntax : ssh-keygen | |
| 2.Then use 'ssh-copy-id' command to copy ssh key to remote system | |
| Syntax : ssh-copy-id user@remote_ip | |
| Ex: ssh-copy-id [email protected] | |
| 3.Now type ssh with remote user name and ip | |
| Ex : ssh [email protected] | |
| ## Connect To Remote System with name ,no need of ip | |
| ##If you only want the name for ssh and ssh only, you can add a name to your ssh config in ~/.ssh/config | |
| Syntax : | |
| File : ~/.ssh/config | |
| Host database | |
| HostName <real IP address or hostname here> | |
| User username | |
| Ex: | |
| Host Server | |
| HostName 192.168.1.22 | |
| User lakshman | |
| ssh Server |