Herramientas de usuario

Herramientas del sitio


wiki2:linux_howto

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:linux_howto [2020/08/25 16:22]
alfred
wiki2:linux_howto [2022/05/09 09:41] (actual)
Línea 1: Línea 1:
 ====== Linux how tos ====== ====== Linux how tos ======
  
 +===== Find and prepare new hard-disks =====
  
 +On modern udev installations,​ there are symbolic links to storage media in subdirectories of /dev/disk, that let you look up a disk or a partition by serial number (/​dev/​disk/​by-id/​),​ by UUID (/​dev/​disk/​by-uuid),​ by filesystem label (/​dev/​disk/​by-label/​) or by hardware connectivity (/​dev/​disk/​by-path/​).
 +
 +Linux also provides the lsblk utility which displays a nice tree view of the storage volume.
 +
 +To prepare:
 +<​code>​
 +mkdir -p /mnt/vdb
 +mkfs.ext4 /dev/vdb
 +mount /dev/vdb /mnt/vdb
 +</​code>​
 +
 +===== Services =====
 +==== List services ====
 +<​code>​
 +pstree
 +service --status-all
 +</​code>​
 ===== Navigate on files ===== ===== Navigate on files =====
  
Línea 14: Línea 32:
  
  
-=== Find those files with contain "​X"​ ===+=== Find those files that contain "​X"​ ===
  
 <​code>​ <​code>​
Línea 39: Línea 57:
 grep --exclude-dir={dir1,​dir2,​*.dst} -rnw '/​path/​to/​somewhere/'​ -e "​pattern"​ grep --exclude-dir={dir1,​dir2,​*.dst} -rnw '/​path/​to/​somewhere/'​ -e "​pattern"​
 </​code>​ </​code>​
 +=== Find those files that contain "​X"​ and "​Y"​ ===
 +
 +<​code>​
 +# Being X = "'​pending':​ False,"​
 +# Being Y = "'​program_id':​ '​sps_lease'"​
 +grep -rl '​.'​ -e "'​pending':​ False,"​ | xargs grep -l -e "'​program_id':​ '​sps_lease'"​
 +</​code>​
 +
 +=== Search only in some files with extension... ===
 +
 +<​code>​
 +grep -rn '/​home/​alfred/​Workspaces'​ --include \*.py --include \*.pyc -e '​bcrypt'​
 +</​code>​
 +
  
 ===== Environment variables ===== ===== Environment variables =====
Línea 85: Línea 117:
  
 ''​env''​ también te sirve para listar las variables de entorno definidas en esta sesión. ''​env''​ también te sirve para listar las variables de entorno definidas en esta sesión.
 +
 +
 +===== How to create a ram disk =====
 +
 +There are two available types:
 +
 +  * ramfs file systems cannot be limited in size like a disk base file system which is limited by it’s capacity. ramfs will continue using memory storage until the system runs out of RAM and likely crashes or becomes unresponsive. This is a problem if the application writing to the file system cannot be limited in total size. Another issue is you cannot see the size of the file system in df and it can only be estimated by looking at the cached entry in free.
 +  * tmpfs is a more recent RAM file system which overcomes many of the drawbacks with ramfs. You can specify a size limit in tmpfs which will give a ‘disk full’ error when the limit is reached. This behaviour is exactly the same as a partition of a physical disk.
 +
 +To mount a disk:
 +<​code>​
 +mount -t tmpfs -o size=512m tmpfs /​mnt/​ramdisk
 +mount -o size=16G -t tmpfs none /mnt/tmpfs
 +</​code>​
 +
 +''​mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]''​. [TYPE] is the type of RAM disk to use; either tmpfs or ramfs. [SIZE] is the size to use for the file system. Remember that ramfs does not have a physical limit and is specified as a starting size. [FSTYPE] is the type of RAM disk to use; either tmpfs, ramfs, ext4, etc.
 +
 +You can also edit the fstab file:
 +<​code>​
 +tmpfs       /​mnt/​ramdisk tmpfs   ​nodev,​nosuid,​noexec,​nodiratime,​size=1024M ​  0 0
 +tmpfs    /​home/​szymon/​ramdisk ​   tmpfs    rw,​size=512M,​mode=777 0    0
 +</​code>​
 +
 +You can also use SquashFS. SquashFS is intended for general read-only file system use and in constrained block device/​memory systems (e.g. embedded systems) where low overhead is needed. The standard version of SquashFS uses gzip compression,​ although there is also a project that brings LZMA compression to SquashFS. Install squasfsh tools: \\ 
 +''​sudo apt-get install squashfs-tools''​ \\ 
 + ​Create .sqsh file: \\
 +''​mksquashfs /​usr/​lib/​jvm/​java-6-sun-1.6.0.21 /​home/​nancom/​jdk6.sqsh''​ \\ 
 +Unsquash: \\ 
 +''​unsquashfs [options] target [files/​directories to extract] $shell > sudo mount /​home/​nancom/​jdk6.sqsh /​media/​ramdisk -t squashfs -o loop sudo update-alternatives --install "/​usr/​bin/​java"​ "​java"​ "/​media/​ramdisk/​bin/​java"​ 1 Check install java complete sudo update-alternatives --config java''​ \\
 + !! And choose java in ram !! !! Finish !! !! Make it permanant on startup !! Edit /etc/fstab add line: /​home/​nancom/​jdk6.sqsh /​media/​ramdisk squashfs ro,​defaults,​loop 0 0
 +
 +
 +===== MessageBox =====
 +
 +==== Yes and no questions ====
 +<​code>​
 +if zenity --question --text="​What do you choose?";​ then
 +    zenity --info --text="​You pressed \"​Yes\"​!"​
 +else
 +    zenity --info --text="​You pressed \"​No\"​!"​
 +fi
 +</​code>​
  
 ===== <​fast>​ How to'​s... ==== ===== <​fast>​ How to'​s... ====
Línea 182: Línea 256:
 sudo update-alternatives --config java sudo update-alternatives --config java
 </​code>​ </​code>​
-==== How to create a ram disk ==== 
- 
-There are two available types: 
- 
-  * ramfs file systems cannot be limited in size like a disk base file system which is limited by it’s capacity. ramfs will continue using memory storage until the system runs out of RAM and likely crashes or becomes unresponsive. This is a problem if the application writing to the file system cannot be limited in total size. Another issue is you cannot see the size of the file system in df and it can only be estimated by looking at the cached entry in free. 
-  * tmpfs is a more recent RAM file system which overcomes many of the drawbacks with ramfs. You can specify a size limit in tmpfs which will give a ‘disk full’ error when the limit is reached. This behaviour is exactly the same as a partition of a physical disk. 
- 
-To mount a disk: 
-<​code>​ 
-mount -t tmpfs -o size=512m tmpfs /​mnt/​ramdisk 
-mount -o size=16G -t tmpfs none /mnt/tmpfs 
-</​code>​ 
- 
-''​mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]''​. [TYPE] is the type of RAM disk to use; either tmpfs or ramfs. [SIZE] is the size to use for the file system. Remember that ramfs does not have a physical limit and is specified as a starting size. [FSTYPE] is the type of RAM disk to use; either tmpfs, ramfs, ext4, etc. 
- 
-You can also edit the fstab file: 
-<​code>​ 
-tmpfs       /​mnt/​ramdisk tmpfs   ​nodev,​nosuid,​noexec,​nodiratime,​size=1024M ​  0 0 
-tmpfs    /​home/​szymon/​ramdisk ​   tmpfs    rw,​size=512M,​mode=777 0    0 
-</​code>​ 
- 
-You can also use SquashFS. SquashFS is intended for general read-only file system use and in constrained block device/​memory systems (e.g. embedded systems) where low overhead is needed. The standard version of SquashFS uses gzip compression,​ although there is also a project that brings LZMA compression to SquashFS. Install squasfsh tools: \\  
-''​sudo apt-get install squashfs-tools''​ \\  
- ​Create .sqsh file: \\ 
-''​mksquashfs /​usr/​lib/​jvm/​java-6-sun-1.6.0.21 /​home/​nancom/​jdk6.sqsh''​ \\  
-Unsquash: \\  
-''​unsquashfs [options] target [files/​directories to extract] $shell > sudo mount /​home/​nancom/​jdk6.sqsh /​media/​ramdisk -t squashfs -o loop sudo update-alternatives --install "/​usr/​bin/​java"​ "​java"​ "/​media/​ramdisk/​bin/​java"​ 1 Check install java complete sudo update-alternatives --config java''​ \\ 
- !! And choose java in ram !! !! Finish !! !! Make it permanant on startup !! Edit /etc/fstab add line: /​home/​nancom/​jdk6.sqsh /​media/​ramdisk squashfs ro,​defaults,​loop 0 0 
  
  
Línea 371: Línea 417:
 sudo mount 10.10.10.10:/​volume1/​sir-vices ./data sudo mount 10.10.10.10:/​volume1/​sir-vices ./data
 </​code>​ </​code>​
 +
 +==== Update system Certificate Authority ====
 +
 +<​code>​
 +sudo apt-get install apt-transport-https ca-certificates -y
 +sudo update-ca-certificates
 +</​code>​
 +
 ===== Notes about Mint ===== ===== Notes about Mint =====
  
wiki2/linux_howto.1598372523.txt.gz · Última modificación: 2020/08/25 17:22 (editor externo)