2.6 KiB
2.6 KiB
BashConfig
Content
Project description
Bash config files
SSH
Create ssh key on local device
ssh-keygen- Save to
~/.ssh - Enter passphrase
- Copy content of
~/.ssh/id_rsa.pubkey to remote~/.ssh/authorized_keys
Add aliases for ssh to ~/.ssh/config:
Host host_name
HostName ip
Port 22
User root
IdentityFile ~/.ssh/id_rsa
Using aliases:
ssh host_name
sftp host_name
Tips
Bash
| Command | Description |
|---|---|
Alt + . Esc + . |
Last object |
Ctrl + r |
Search by bash_history |
Ctrl + l |
Clear, like command clear |
Vim
| Command | Description |
|---|---|
Ctrl + [ |
Analog Esc |
d -> Ctrl + End |
Delete from cursor to end of file |
u |
Undo |
Ctrl + r |
Redo |
22G |
Go to line 22 |
Update .bashrc .bash_aliases by ssh
ssh hosting 'rm -rf ~/BashConfig; git clone https://github.com/TheK4n/BashConfig && cp BashConfig/.bash* ~/BashConfig; rm -rf ~/BashConfig'
Autostart
sudo vim /etc/systemd/system/<your_bot_name>.service
sudo systemctl daemon-reload
sudo systemctl start <your_bot_name>.service
sudo systemctl status <your_bot_name>.service
sudo systemctl enable <your_bot_name>.service
"/etc/systemd/system/<your_bot_name>.service"
[Unit]
Description=<DESCRIPTION>
After=network.target
[Service]
Type=simple
User=<username>
Group=<user_group>
ExecStart=<full_path_to_executor> <full_path_to_script>
ExecReload=<full_path_to_executor> <full_path_to_script>
WorkingDirectory=<full_path_to_bot>
KillMode=process
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target