Usefull Commands
List of commands that may be usefull
Burn an iso
It is much easier to use ventoy now. The USB stick can still be used for storage, and any iso can be added by just copying it to the stick without burning it again.
First, list available devices:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 1.8T 0 disk
├─sda1 8:1 0 1G 0 part
├─sda2 8:2 0 1.2T 0 part
├─sda3 8:3 0 204.8G 0 part
└─sda4 8:4 0 428.4G 0 part
sdb 8:16 1 28.9G 0 disk
├─sdb1 8:17 1 28.9G 0 part
└─sdb2 8:18 1 32M 0 part
nvme0n1 259:0 0 476.9G 0 disk
├─nvme0n1p1 259:1 0 260M 0 part
├─nvme0n1p2 259:2 0 16M 0 part
├─nvme0n1p3 259:3 0 250.8G 0 part
├─nvme0n1p4 259:4 0 850M 0 part
├─nvme0n1p5 259:5 0 1G 0 part
└─nvme0n1p6 259:6 0 224G 0 part
Here, the USB flashdrive is /dev/sdb. Replace it in the next command by your own value:
dd bs=4M if=/path/to/iso of=/dev/sdb status=progress oflag=sync
List partition info
fdisk -l
Reboot to BIOS
Reboot computer and boot to BIOS:
systemctl reboot --firmware-setup
Symbolic links
Create a symbolique link:
$ ln -s /path/taker /path/link
Remove a link
$ unlink /path/link
tar.gz
Create a tar.gz:
$ tar -cvzf foo.tar.gz foo
Extract a tar.gz:
$ tar -xvzf foo.tar.gz
Options:
-c: create-f: file/folder name-v: verbose-x: extract-z: [un]compress
Zip
Create a password protected zip
$ zip -r -e zipped_folder.zip folder_to_zip/
Enter password:
Verify password:
adding: folder_to_zip/ (stored 0%)
adding: folder_to_zip/file.pdf (deflated 2%)
Options
-r: recursif-e: encrypt, prompt for a password to protect the zip
Convert video type
ffmpeg, exemple converting mkv to mp4:
$ mpeg -i video.mkv -codec copy video.mp4
Find the type of a file
$ file unknwoned_file
unknwoned_file: PNG image data, 225 x 225, 8-bit/color RGB, non-interlaced
Download a website
$ wget -c -e robots=off -E -p -r -U 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' -np --convert-links --no-clobber --random-wait http://<example.com>/<stuff>
Options:
-
-b: runs it in background and cant see progress -
-c: continue getting a partially-downloaded file. This is useful when you want to finish up a download started by a previous instance of Wget, or by another program -
-e: robots=off: act like we are not a robot - not like a crawler - websites dont like robots/crawlers unless they are google/or other famous search engine -
-E: gets the right extension of the file, without most html and other files have no extension -
-p: get all the page requisites. e.g. get all the image/css/js files linked from the page. -
-r: recursive - downloads full website -
-U: pretends to be just like a browser Mozilla is looking at a page instead of a crawler like wget -
-nd: do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files will get saved to the current directory, without clobbering -
-np: wget will not follow links up the url. e.g. it will not follow a link from devopsa.net/linux/curl.html to devopsa.net/linux.html -
--connect-timeout: Set the connect timeout to seconds seconds. TCP connections that take longer to establish will be aborted -
--convert-links: convert links so that they work locally, off-line, instead of pointing to a website online -
--limit-rate: limit download speed -
--no-clobber: don’t overwrite any existing files (used in case the download is interrupted and resumed) -
--random-wait: random waits between download -
--restrict-file-names: change which characters found in remote URLs must be escaped during generation of local filenames -
--spider: wget will behave as a Web spider, which means that it will not download the pages, just check that they are there -
--tries: set number of retries to number -
--user-agent: identify as agent-string to the HTTP server