modified: README.md
This commit is contained in:
138
README.md
138
README.md
@@ -1,11 +1,15 @@
|
||||
# Linux
|
||||
|
||||
## Table of contents
|
||||
<!-- TOC -->
|
||||
- [hostname/hostnamectl](#hostnamehostnamectl)
|
||||
- [Linux](#linux)
|
||||
- [Table of contents](#table-of-contents)
|
||||
- [Update](#update)
|
||||
- [Debian / Ubuntu](#debian--ubuntu)
|
||||
- [Fedora](#fedora)
|
||||
- [ls](#ls)
|
||||
- [Users](#users)
|
||||
- [hostame](#hostame)
|
||||
- [hostname / hostnamectl](#hostname--hostnamectl)
|
||||
- [static ip](#static-ip)
|
||||
- [Disks](#disks)
|
||||
- [mount](#mount)
|
||||
@@ -24,34 +28,25 @@
|
||||
- [Create key](#create-key)
|
||||
- [Copy public key](#copy-public-key)
|
||||
- [Add existing Key](#add-existing-key)
|
||||
- [alias](#alias)
|
||||
- [Alias](#alias)
|
||||
- [Port Binding](#port-binding)
|
||||
- [Documentation](#documentation)
|
||||
- [Benchmarking](#benchmarking)
|
||||
- [themes](#themes)
|
||||
- [shell](#shell)
|
||||
- [terminal](#terminal)
|
||||
- [Backups](#backups)
|
||||
- [bash](#bash)
|
||||
- [disable touh screen](#disable-touh-screen)
|
||||
- [disable suspend blackscreen](#disable-suspend-blackscreen)
|
||||
- [disable touch screen](#disable-touch-screen)
|
||||
- [disable suspend black screen](#disable-suspend-black-screen)
|
||||
- [lightdm auto login](#lightdm-auto-login)
|
||||
- [btop](#btop)
|
||||
- [Setup](#setup)
|
||||
- [Debian & Ubuntu](#debian--ubuntu)
|
||||
- [Debian \& Ubuntu](#debian--ubuntu-1)
|
||||
- [lspci](#lspci)
|
||||
- [gnome files / nautilus](#gnome-files--nautilus)
|
||||
<!-- /TOC -->
|
||||
|
||||
# Linux
|
||||
|
||||
## hostname/hostnamectl
|
||||
|
||||
```bash
|
||||
#get hostname
|
||||
hostname
|
||||
|
||||
#set hostname
|
||||
hostnamectl
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
@@ -115,9 +110,16 @@ chown [-c|--changes] [-v|--verbose] [-f|--silent|--quiet] [--dereference]
|
||||
{new-owner|--reference=ref-file} file ...
|
||||
```
|
||||
|
||||
## hostame
|
||||
## hostname / hostnamectl
|
||||
|
||||
``` bash
|
||||
|
||||
#get hostname
|
||||
hostname
|
||||
|
||||
#set hostname
|
||||
hostnamectl
|
||||
|
||||
```
|
||||
sudo nano /etc/hostname
|
||||
#alterar o nome
|
||||
sudo nano /etc/hosts
|
||||
@@ -132,7 +134,7 @@ Debian
|
||||
sudo nano /etc/network/interfaces
|
||||
Exemplo de configuração
|
||||
|
||||
```
|
||||
``` bash
|
||||
# neste exemplo de configuração a place de rede tem o nome enxd0374555c1f8
|
||||
|
||||
# This file describes the network interfaces available on your system
|
||||
@@ -155,7 +157,7 @@ iface enxd0374555c1f8 inet static
|
||||
Reiniciar configuração sem reboot de computador
|
||||
```
|
||||
|
||||
```
|
||||
``` bash
|
||||
Reiniciar configuração sem reboot de computador
|
||||
#sudo /etc/init.d/networking restart
|
||||
```
|
||||
@@ -164,25 +166,25 @@ Reiniciar configuração sem reboot de computador
|
||||
|
||||
File System & Space Usage
|
||||
|
||||
```
|
||||
``` bash
|
||||
df -h
|
||||
```
|
||||
|
||||
List physical disks and partition size
|
||||
|
||||
```
|
||||
``` bash
|
||||
lsblk
|
||||
```
|
||||
|
||||
List partition ids
|
||||
|
||||
```
|
||||
``` bash
|
||||
blkid /dev/sdc1
|
||||
```
|
||||
|
||||
Partition Manager
|
||||
|
||||
```
|
||||
``` bash
|
||||
fdisk /dev/<DISK NAME>
|
||||
#Example:
|
||||
fdisk /dev/sdc
|
||||
@@ -201,22 +203,22 @@ mkpart primary ext4 0 4
|
||||
|
||||
## mount
|
||||
|
||||
Mount partion on boot fstab
|
||||
Mount partition on boot fstab
|
||||
|
||||
```
|
||||
``` bash
|
||||
nano /etc/fstabexemplo de alias
|
||||
```
|
||||
|
||||
ext4 example
|
||||
|
||||
```
|
||||
``` bash
|
||||
#add line
|
||||
PARTUUID=<PARTUUID GIVEN blksid> <FOLDER WHERE TO MOUNT> ext4 defaults,nofail 0 02
|
||||
```
|
||||
|
||||
Mount fstab partions without reboot
|
||||
|
||||
```
|
||||
``` bash
|
||||
mount -a
|
||||
```
|
||||
|
||||
@@ -224,7 +226,7 @@ smb share
|
||||
|
||||
Create credentials file
|
||||
|
||||
```
|
||||
``` bash
|
||||
#/home/mf/.credentials/smb:mf@nas.lan
|
||||
username=shareuser
|
||||
password=sharepassword
|
||||
@@ -233,13 +235,13 @@ domain=domain_or_workgroupname
|
||||
|
||||
Secure credentials file permission
|
||||
|
||||
```
|
||||
``` bash
|
||||
chmod 0600 /home/mf/.credentials/smb:mf@nas.lan
|
||||
```
|
||||
|
||||
Add line
|
||||
|
||||
```
|
||||
``` bash
|
||||
#/etc/fstab
|
||||
//nas.lan/homes /mnt/smb-share:mf@nas.lan,share=homes cifs credentials=/home/mf/.credentials/smb:mf@nas.lan,uid=1000,gid=1000,nofail 0 0
|
||||
```
|
||||
@@ -280,7 +282,7 @@ mkfs.ext3 _filesys_
|
||||
|
||||
Example
|
||||
|
||||
```
|
||||
``` bash
|
||||
mkfs.ext3 /dev/sdb1
|
||||
#exFat
|
||||
mkfs.exfat /dev/sdc1
|
||||
@@ -291,13 +293,13 @@ mkfs.exfat /dev/sdc1
|
||||
|
||||
mkfs.exfat _filesys_
|
||||
|
||||
```
|
||||
``` bash
|
||||
mkfs.exfat /dev/sdc1
|
||||
```
|
||||
|
||||
### ntfs
|
||||
|
||||
```
|
||||
``` bash
|
||||
apt-get install ntfs-3g
|
||||
mkntfs --fast --label Backups /dev/sdc1
|
||||
```
|
||||
@@ -314,7 +316,7 @@ du -h --max-depth=1
|
||||
|
||||
Bad Sectors
|
||||
sudo e2fsck -cfpv /dev/sda1
|
||||
O Exemplo foi com o disco sda1 mas deverá ser subsituido pelo disco desejado
|
||||
O Exemplo foi com o disco sda1 mas deverá ser substituído pelo disco desejado
|
||||
|
||||
Os parâmetros têm os seguintes significados:
|
||||
|
||||
@@ -355,7 +357,8 @@ ssh-keygen -t ecdsa -b 521 -f ~/.ssh/key-ecdsa
|
||||
|
||||
### Copy public key
|
||||
|
||||
```bashssh-add ~/.ssh/id_ed25519
|
||||
```bash
|
||||
ssh-add ~/.ssh/id_ed25519
|
||||
ssh-copy-id -i ~/.ssh//ey-ecdsa.pub example_user@192.0.2.4
|
||||
```
|
||||
|
||||
@@ -365,7 +368,7 @@ ssh-copy-id -i ~/.ssh//ey-ecdsa.pub example_user@192.0.2.4
|
||||
ssh-add ~/.ssh/key-ecdsa
|
||||
```
|
||||
|
||||
### alias
|
||||
### Alias
|
||||
|
||||
```bash
|
||||
Host srv01
|
||||
@@ -375,6 +378,56 @@ Host srv01
|
||||
RequestTTY yes
|
||||
```
|
||||
|
||||
### Port Binding
|
||||
|
||||
Bind local port 8001 to target-server port 80 using jump-machine.local.
|
||||
_(local machine without direct access to target-server)_
|
||||
|
||||
```bash
|
||||
ssh -f -N -L localhost:8001:target-server:80 usr@jump-machine.local
|
||||
```
|
||||
|
||||
#### Documentation
|
||||
|
||||
``` bash
|
||||
# man
|
||||
-f Requests ssh to go to background just before command
|
||||
execution. This is useful if ssh is going to ask for
|
||||
passwords or passphrases, but the user wants it in the
|
||||
background. This implies -n. The recommended way to
|
||||
start X11 programs at a remote site is with something
|
||||
like ssh -f host xterm.
|
||||
|
||||
-N Do not execute a remote command. This is useful for just
|
||||
forwarding ports. Refer to the description of
|
||||
SessionType in ssh_config(5) for details.
|
||||
|
||||
-L [bind_address:]port:host:hostport
|
||||
-L [bind_address:]port:remote_socket
|
||||
-L local_socket:host:hostport
|
||||
-L local_socket:remote_socket
|
||||
|
||||
Specifies that connections to the given TCP port or Unix socket on the
|
||||
local (client) host are to be forwarded to the given host and port, or
|
||||
Unix socket, on the remote side. This works by allocating a socket to
|
||||
listen to either a TCP port on the local side, optionally bound to the
|
||||
specified bind_address, or to a Unix socket. Whenever a connection is
|
||||
made to the local port or socket, the connection is forwarded over the
|
||||
secure channel, and a connection is made to either host port hostport,
|
||||
or the Unix socket remote_socket, from the remote machine.
|
||||
|
||||
Port forwardings can also be specified in the configuration file. Only
|
||||
the superuser can forward privileged ports. IPv6 addresses can be
|
||||
specified by enclosing the address in square brackets.
|
||||
|
||||
By default, the local port is bound in accordance with the GatewayPorts
|
||||
setting. However, an explicit bind_address may be used to bind the
|
||||
connection to a specific address. The bind_address of “localhost”
|
||||
indicates that the listening port be bound for local use only, while an
|
||||
empty address or ‘*’ indicates that the port should be available from
|
||||
all interfaces.
|
||||
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
@@ -384,7 +437,7 @@ sudo hdparm -Tt /dev/sdc
|
||||
|
||||
## themes
|
||||
|
||||
- https://github.com/EliverLara/Nordic
|
||||
- <https://github.com/EliverLara/Nordic>
|
||||
|
||||
### shell
|
||||
|
||||
@@ -462,7 +515,7 @@ find $BACKUP_DIR/* -mtime +10 -exec rm {} \;
|
||||
gio mount -u ftp://ftp.backups@backupsrv01.dev.lan
|
||||
```
|
||||
|
||||
## disable touh screen
|
||||
## disable touch screen
|
||||
|
||||
``` bash
|
||||
sudo apt-get -y install xinput
|
||||
@@ -485,6 +538,7 @@ Source: https://askubuntu.com/questions/759335/how-to-disable-a-touchscreen-on-s
|
||||
[Seat:*]
|
||||
xserver-command=X -s 0 dpms
|
||||
```
|
||||
|
||||
## lightdm auto login
|
||||
|
||||
```bash
|
||||
@@ -512,16 +566,14 @@ Displays information about each PCI bus on your system. This includes informatio
|
||||
|
||||
lspci [options]
|
||||
|
||||
|
||||
| Option | Description |
|
||||
| -------- | ------------- |
|
||||
| -v | Verbose |
|
||||
|
||||
|
||||
``` bash
|
||||
lspci -v
|
||||
```
|
||||
|
||||
## gnome files / nautilus
|
||||
|
||||
https://www.maketecheasier.com/useful-nautlius-tweaks-linux/
|
||||
<https://www.maketecheasier.com/useful-nautlius-tweaks-linux/>
|
||||
|
||||
Reference in New Issue
Block a user