Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| playground:playground [2024/05/31 10:54] – norman | playground:playground [2025/08/21 11:11] (current) – [Create Users Trash Bin] norman | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | ===== Ping until reachable: | + | ===== Create Users Trash Bin ====== |
| - | < | ||
| - | |||
| - | |||
| - | ===== Linux Enable H.264 codec support for Opera browser ===== | ||
| - | |||
| - | == Works With: Opera One(version: | ||
| - | |||
| - | |||
| - | For Debian distros can use this: [[https:// | ||
| - | |||
| - | < | ||
| - | unzip 0.85.0-linux-x64.zip | ||
| - | mv libffmpeg.so / | ||
| - | |||
| - | libffmpeg.so source: [[https:// | ||
| - | |||
| - | ===== how to remove all characters after and including " | ||
| - | |||
| - | |||
| - | < | ||
| - | mv -n " | ||
| - | echo mv -n " | ||
| - | done | ||
| - | </ | ||
| - | |||
| - | |||
| - | == Install Script Internal == | ||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ====== Changing the default text editor on Linux ====== | ||
| - | |||
| - | |||
| - | The default command line text editor on Linux (and BSD varaiants) determines what is used when you run commands such as “crontab -e” and is often not what you want to use yourself. Typcially vi/vim is the default text editor; many people prefer emacs or other editors, and I prefer to use nano myself. | ||
| - | |||
| - | It’s easy to change this default text editor by using the system’s environment variables. Both the EDITOR and VISUAL environment variables determine which text editor is used at the default, and you can set either to change the default behaviour to the text editor you prefer like so from the command line: | ||
| - | |||
| - | * export EDITOR=nano | ||
| - | The above example will make “nano” the default editor, and you can substitute “nano” for your preferred editor. You don’t have to specify the full path to the application, | ||
| - | |||
| - | * export EDITOR=/ | ||
| - | You can find the full path to a file using the “whereis” command like so: | ||
| - | |||
| - | * $ whereis nano | ||
| - | nano: / | ||
| - | Setting the EDITOR environment variable from the command line as shown above will only last as long as your current session; once you log out the default behaviour will apply again when you next log in. To make the change permanent, add the export value to your ~/ | ||
| - | |||
| - | Adding the entry to your ~/ | ||
| - | |||
| - | * . ~/ | ||
| - | To make the default editor change global and apply to all users, unless overridden in their ~/ | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | |||
| - | |||
| - | Check if website down: http:// | ||
| - | |||
| - | * sox ./ | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | for i in *.mp3; do | ||
| - | sox “$i” –channels 2 “ ${i%.mp3}.mp3” | ||
| - | done | ||
| - | |||
| - | ---- | ||
| - | |||
| - | ====== HOW DO I CONVERT A PDF TO TEXT? ====== | ||
| - | |||
| - | Convert a pdf file called hp-manual.pdf to hp-manual.txt, | ||
| - | * $ pdftotext hp-manual.pdf hp-manual.txt | ||
| - | |||
| - | Specifies the first page 5 and last page 10 (select 5 to 10 pages) to convert, enter: | ||
| - | * $ pdftotext -f 5 -l 10 hp-manual.pdf hp-manual.txt | ||
| - | |||
| - | Convert a pdf file protected and encrypted by owner password: | ||
| - | * $ pdftotext -opw ‘password’ hp-manual.pdf hp-manual.txt | ||
| - | |||
| - | Convert a pdf file protected and encrypted by user password: | ||
| - | * $ pdftotext -upw ‘password’ hp-manual.pdf hp-manual.txt | ||
| - | |||
| - | Sets the end-of-line convention to use for text output. You can set it to unix, dos or mac. For UNIX / Linux oses, enter: | ||
| - | * $ pdftotext -eol unix hp-manual.pdf hp-manual.txt | ||
| - | |||
| - | To be more specific, | ||
| - | editing ~/ | ||
| - | * {“value”: | ||
| - | to this: | ||
| - | * {“value”: | ||
| - | |||
| - | ---- | ||
| - | |||
| - | cd ~/Downloads # or wherever you downloaded a font pack. | ||
| - | unzip .zip | ||
| - | # for a single user | ||
| - | mkdir -p ~/.fonts | ||
| - | cp *otf *otc ~/.fonts | ||
| - | fc-cache -f -v # optional | ||
| - | # for all users | ||
| - | sudo mkdir -p / | ||
| - | sudo cp *otf *otc / | ||
| - | sudo fc-cache -f -v # optional | ||
| - | |||
| - | ---- | ||
| - | |||
| - | * normalize-audio -b -v -l ./*.mp3 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | |||
| - | Disable suspend and hibernation | ||
| - | For systems which should never attempt any type of suspension, these targets can be disabled at the systemd level with the following: | ||
| - | |||
| - | sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target | ||
| - | To re-enable hibernate and suspend use the following command: | ||
| - | |||
| - | sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target | ||
| - | |||
| - | ---- | ||
| - | |||
| - | # background color using ANSI escape | ||
| - | |||
| - | * bgBlack=$(tput setab 0) # black | ||
| - | * bgRed=$(tput setab 1) # red | ||
| - | * bgGreen=$(tput setab 2) # green | ||
| - | * bgYellow=$(tput setab 3) # yellow | ||
| - | * bgBlue=$(tput setab 4) # blue | ||
| - | * bgMagenta=$(tput setab 5) # magenta | ||
| - | * bgCyan=$(tput setab 6) # cyan | ||
| - | * bgWhite=$(tput setab 7) # white | ||
| - | |||
| - | # foreground color using ANSI escape | ||
| - | |||
| - | * fgBLack=$(tput setaf 0) # black | ||
| - | * fgRed=$(tput setaf 1) # red | ||
| - | * fgGreen=$(tput setaf 2) # green | ||
| - | * fgYellow=$(tput setaf 3) # yellow | ||
| - | * fgBlue=$(tput setaf 4) # blue | ||
| - | * fgMagenta=$(tput setaf 5) # magenta | ||
| - | * fgCyan=$(tput setaf 6) # cyan | ||
| - | * fgWhite=$(tput setaf 7) # white | ||
| - | |||
| - | # text editing options | ||
| - | |||
| - | * txBold=$(tput bold) # bold | ||
| - | * txHalf=$(tput dim) # half-bright | ||
| - | * txUnderline=$(tput smul) # underline | ||
| - | * txEndUnder=$(tput rmul) # exit underline | ||
| - | * txReverse=$(tput rev) # reverse | ||
| - | * txStandout=$(tput smso) # standout | ||
| - | * txEndStand=$(tput rmso) # exit standout | ||
| - | * txReset=$(tput sgr0) # reset attributes | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | rdfind -makehardlinks true /servers2/* | ||
| - | |||
| - | ---- | ||
| - | |||
| - | |||
| - | Selecting the Primary Audio Device | ||
| - | If your system keeps on using the wrong device (HDMI instead of PCH or vica versa for example), you can force ALSA to use the correct device. Start by getting a list of your audio devices with the command: | ||
| - | |||
| - | cat / | ||
| - | |||
| - | Note the number of the sound device that you want to make the primary. Then using a text editor, put the following into / | ||
| - | |||
| - | defaults.pcm.card 1 | ||
| - | defaults.ctl.card 1 | ||
| - | |||
| - | |||
| - | serverim, HDMI, Audacity paliidz identificeet. | ||
| - | defaults.pcm.card 1 | ||
| - | defaults.ctl.card 1 | ||
| - | |||
| - | defaults.pcm.!device 7 | ||
| - | defaults.ctl.!device 7 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | |||
| - | Use vlc as root: | ||
| - | |||
| - | * sed -i ‘s/ | ||
| - | |||
| - | * mp3info -p “%f %o \n” ./*.mp3 | ||
| - | |||
| - | ---- | ||
| - | |||
| - | |||
| - | You can rotate your virtual framebuffers using fbcon. 0 through 3 to represent the various rotations: | ||
| - | |||
| - | 0 – Normal rotation | ||
| - | 1 – Rotate clockwise | ||
| - | 2 – Rotate upside down | ||
| - | 3 – Rotate counter-clockwise | ||
| - | These can be set from the command line by putting a value into the correct system file. Rotate the current framebuffer: | ||
| - | |||
| - | echo 1 | sudo tee / | ||
| - | Rotate all virtual framebuffers: | ||
| - | |||
| - | echo 1 | sudo tee / | ||
| - | If you want this to happen automatically when you start your system, you need to modify your boot loader configuration to give it the correct options. In / | ||
| - | |||
| - | GRUB_CMDLINE_LINUX=”fbcon=rotate: | ||
| - | (Don’t forget to run sudo update-grub after changing this file.) | ||
| - | |||
| - | ---- | ||
| - | |||
| - | Autologin Debian console: | ||
| - | |||
| - | Edit your / | ||
| - | * change #NAutoVTs=6 to NAutoVTs=1 | ||
| - | |||
| - | * Create a / | ||
| - | |||
| - | * systemctl edit getty@tty1 | ||
| - | Past the following lines | ||
| - | |||
| - | <webcode name=" | ||
| - | [Service] | ||
| - | ExecStart= | ||
| - | ExecStart=-/ | ||
| - | </ | ||
| - | |||
| - | enable the getty@tty1.service then reboot. | ||
| - | |||
| - | * systemctl enable getty@tty1.service | ||
| - | * reboot | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | runaajosh pulktens Linuxaa.. | ||
| - | |||
| - | echo “Its” `date “+%H and %M now”` | festival –tts | ||
| - | apt install festival -y | ||
| - | |||
| - | # Balss variants | ||
| - | apt install festvox-kdlpc16k | ||
| - | |||
| - | export XDG_RUNTIME_DIR=”/ | ||
| - | |||
| - | ---- | ||
| - | |||
| - | Gentoo: | ||
| - | When you emerge ices and icecast Portage does not create startup or shutdown scripts for you. You can use the following scripts to start and stop ices and icecast: | ||
| - | |||
| - | Code Listing 3.1: / | ||
| - | Code: | ||
| - | <webcode name=" | ||
| - | # | ||
| - | # Copyright 1999-2004 Gentoo Technologies, | ||
| - | # Distributed under the terms of the GNU General Public License v2 | ||
| - | |||
| - | depend() { | ||
| - | need icecast net | ||
| - | use dns | ||
| - | } | ||
| - | |||
| - | start() { | ||
| - | ebegin “Starting ices” | ||
| - | start-stop-daemon –start –chuid icecast –quiet –exec / | ||
| - | — / | ||
| - | eend $? | ||
| - | } | ||
| - | |||
| - | stop () { | ||
| - | ebegin “Stopping ices” | ||
| - | start-stop-daemon –stop –retry 5 –quiet –exec / | ||
| - | eend $? | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | ====== Disk usage ====== | ||
| - | |||
| - | |||
| - | < | ||
| - | |||
| - | ---- | ||
| - | |||
| - | MySQL by default listens only on the localhost (127.0.0.1) interface. | ||
| - | |||
| - | From configuration file above: | ||
| - | Code: | ||
| - | # | ||
| - | # Instead of skip-networking the default is now to listen only on | ||
| - | # localhost which is more compatible and is not less secure. | ||
| - | # bind-address = 127.0.0.1 | ||
| - | Uncomment the bind-address line, and bind to 0.0.0.0 to bind to all addresses on the system... | ||
| - | |||
| - | |||
| - | ---- | ||
| - | |||
| - | Rename word in file | ||
| - | sed -i ‘s/ | ||
| - | |||
| - | ---- | ||
| - | |||
| - | |||
| - | make options | ||
| - | |||
| - | To uninstall: | ||
| - | * make uninstall #as root | ||
| - | |||
| - | To clean the build after modifying code: | ||
| - | * make clean | ||
| - | |||
| - | To clean and remove previous configure options: | ||
| - | * make distclean | ||
| - | |||
| - | ---- | ||
| - | It can be installed using sudo apt-get install ifmetric. This command can be used to change the metric of any interface. The interface with lower metric is preferred for Internet. | ||
| - | |||
| - | root@icecast ~ # route -n | ||
| - | Kernel IP routing table | ||
| - | <webcode name=" | ||
| - | Destination Gateway Genmask Flags Metric Ref Use Iface | ||
| - | 0.0.0.0 192.168.1.254 0.0.0.0 UG 202 0 0 eth0 | ||
| - | 0.0.0.0 192.168.1.254 0.0.0.0 UG 350 0 0 wlan0 | ||
| - | 192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0 | ||
| - | 192.168.1.0 0.0.0.0 255.255.255.0 U 350 0 0 wlan0 | ||
| - | </ | ||
| - | |||
| - | * ifmetric eth0 10 | ||
| - | |||
| - | ====== Install php-imagick deb based sys ====== | ||
| - | |||
| - | Firstly need to link sed for phpize | ||
| - | |||
| - | * sudo ln -s /bin/sed / | ||
| - | |||
| - | Then: | ||
| - | RUN | ||
| < | < | ||
| - | apt-get update && apt-get install -y \ | + | cd /to/folder |
| - | libmagickwand-dev --no-install-recommends \ | + | |
| - | && pecl install imagick \ | + | |
| - | && docker-php-ext-enable imagick | + | |
| </ | </ | ||
| - | |||
| - | After that You should add " | ||
| - | |||
| - | * Restart Your webserver. | ||
| - | * / | ||
| - | |||
| - | ====== How To Use Byobu ====== | ||
| - | |||
| - | This is very small manual with most common shortcuts. | ||
| - | |||
| - | < | ||
| - | SHIFT + F7 -> Not sure, but sometimes without it don.t activating all commands. | ||
| - | SHIFT + F8 -> tile windows vericaly, i more than 2, then differnet variations. | ||
| - | SHIFT + F5 -> refresh all windows | ||
| - | SHIFT + F6 -> close byobu | ||
| - | SHIFT + Arrow (depends from window location) -> Move between windows | ||
| - | SHIFT + LeftAlt + Arrow (depends from window location) -> resize window</ | ||
| - | |||
| - | **byobu new -s my-other-session -> start another session** | ||
| - | |||
| - | type “Exit” to close unwanted window | ||
| - | |||
| - | < | ||
| - | byobu-disable -> disable byobu to start automatically with system</ | ||
| - | If multiple sessions started, should ask which session to use. | ||
| - | If want to use multiple, recommend to name it nice, as its can not offer session choice. | ||
| - | For example, byobu new -s session1 , byobu new -s session2 … | ||
| - | |||
| - | May be different on different byobu versions. | ||
| - | |||
| - | Full list of commands can find in https:// | ||
| - | |||
| - | ====== Some bits for Gentoo ====== | ||
| - | |||
| - | For laptops may need set max brightness at system boot. | ||
| - | This is for Intel graphics. Others need change intel to Your graphics card | ||
| - | * open crontab -e as root | ||
| - | * enter following line | ||
| - | <webcode name=" | ||
| - | @reboot cat / | ||
| - | </ | ||
| - | |||
| - | ====== Linux wget ====== | ||
| - | |||
| - | < | ||
| - | To avoid downloading the auto-generated index.html files, use the -R/--reject option: | ||
| - | < | ||
| - | For anyone else that having similar issues. Wget follows robots.txt which might not allow you to grab the site. No worries, you can turn it off: | ||
| - | < | ||
| - | |||
| - | |||
| - | ====== Linux autocrop images ====== | ||
| - | |||
| - | Using ImageMagick: | ||
| - | |||
| - | < | ||
| - | To trim/ | ||
| - | |||
| - | < | ||
| - | Or using find: | ||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ====== Usefull Dmesg command ===== | ||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ====== Reconfigure Debian Time Zone ====== | ||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ====== How to stop kernel messages from flooding my console? ====== | ||
| - | |||
| - | Alter < | ||
| - | # Uncomment the following to stop low-level messages on console | ||
| - | < | ||
| - | |||
| - | ====== How can I tell Ubuntu to do nothing when I close my laptop lid ====== | ||
| - | |||
| - | < | ||
| - | |||
| - | Restart the systemd daemon (be aware that this will log you off) with this command: | ||
| - | < | ||
| - | |||
| - | ====== How do I change the font or the font size in the TTY (console) Debian ====== | ||
| - | |||
| - | < | ||
| - | or edit: < | ||
| - | |||
| - | After, for permanent saving (must work): | ||
| - | < | ||
| - | |||
| - | ====== Gentoo Add GB locale ====== | ||
| - | |||
| - | Needed for showing time in 24h format. | ||
| - | Maybe not correct, but working. | ||
| - | Edit locale config: | ||
| - | < | ||
| - | Add following lines (Maybe enough with one: | ||
| - | < | ||
| - | en_GB UTF-8</ | ||
| - | Then: | ||
| - | < | ||
| - | Locale selection | ||
| - | Once done, it is now time to set the system-wide locale settings. Again we use eselect for this, now with the locale module. | ||
| - | |||
| - | With eselect locale list, the available targets are displayed: | ||
| - | < | ||
| - | With eselect locale set < | ||
| - | < | ||
| - | Now reload the environment: | ||
| - | < | ||
| - | |||
| - | |||
| - | ====== Debian Keep audio “awake” ====== | ||
| - | |||
| - | Edit < | ||
| - | |||
| - | < | ||
| - | which becomes: | ||
| - | |||
| - | < | ||
| - | Then restart the sound server. | ||
| - | |||
| - | ====== Generate a Random Password Linux shell====== | ||
| - | |||
| - | < | ||
| - | |||
| - | Source: https:// | ||
| - | |||
| - | |||
| - | ====== Creating samba users ====== | ||
| - | |||
| - | These users must represent Linux users but their password can and should be different to the Linux password for security. This is not enforced, though. Using the command smbpasswd as the root user we can add new samba users. A user must have a password in samba to access shares. | ||
| - | |||
| - | < | ||
| - | smbpasswd -a pi</ | ||
| - | |||
| - | The above commands add root and pi as samba users. By default, a TDB database is used to store this information. You can list current samba users with the command pdbedit. | ||
| - | |||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ====== Terminal Disk Usage (Debian' | ||
| - | |||
| - | Install: | ||
| - | |||
| - | < | ||
| - | |||
| - | First, navigate to directory or simply and run gdu: | ||
| - | < | ||
| - | |||
| - | Since it has terminal user interface (TUI), you can navigate through directories and disk using arrows. You can also sort the result by file names or size. | ||
| - | |||
| - | Here’s how to do that: | ||
| - | |||
| - | * Unordered List ItemUp arrow or k to move cursor up | ||
| - | * Unordered List ItemDown arrow or j to move cursor down | ||
| - | * Unordered List ItemEnter to select directory / device | ||
| - | * Unordered List ItemLeft arrow or h to go to parent directory | ||
| - | * Unordered List ItemUse d to delete the selected file or directory | ||
| - | * Unordered List ItemUse n to sort by name | ||
| - | * Unordered List ItemUse s to sort by size | ||
| - | * Unordered List ItemUse c to sort by items | ||
| - | |||
| - | |||
| - | ====== Small Linux script to change default gw ====== | ||
| - | |||
| < | < | ||
| - | # | + | mkdir -m777 -v .Trash-$UID |
| - | route=$(route | grep default | cut -b 17- | cut -b -13) | + | |
| - | echo $route | + | |
| - | + | ||
| - | if [[ $route == *' | + | |
| - | route del default gw 192.168.1.254 | + | |
| - | route add default gw 192.168.8.1 | + | |
| - | + | ||
| - | else | + | |
| - | + | ||
| - | route del default gw 192.168.8.1 | + | |
| - | route add default gw 192.168.1.254 | + | |
| - | + | ||
| - | fi | + | |
| - | + | ||
| - | sleep 1 | + | |
| - | echo "" | + | |
| - | tput bold | + | |
| - | tput setaf 1 | + | |
| - | route | grep default | cut -b 17- | cut -b -13 | + | |
| - | tput sgr0 | + | |
| </ | </ | ||
| - | ====== GDU Terminal Disk Usage ====== | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | |||
| - | ====== Jellyfin-FFmpeg ====== | ||
| < | < | ||
| - | ./ | + | chown $USER .Trash-$UID |
| </ | </ | ||
| - | |||
| - | |||
| - | ===== Debian List Installed Packages ===== | ||
| - | |||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ==== Gentoo Apache with php ==== | ||
| - | |||
| - | edit: < | ||
| - | |||
| - | need to add "-D PHP" ... | ||
| - | |||
| - | < | ||
| - | |||
| - | Restart apache. | ||
| - | |||
| - | |||
| - | ==== Make Use with X proc's ====or compress | ||
| - | |||
| - | |||
| - | < | ||
| - | |||
| - | ==== Sed replace ==== | ||
| - | |||
| - | < | ||
| - | |||
| - | ====== Linux Shell Find images ====== | ||
| - | |||
| - | < | ||
| - | or | ||
| - | < | ||
| - | or compress | ||
| - | < | ||
| - | |||
| - | ====== Linux netstat command find out which process is listing upon a port ====== | ||
| - | < | ||
| - | |||
| - | ======HTOP | ||
| - | |||
| - | Run htop, press F6, select CPU%. | ||
| - | |||
| - | Quit by using F10 | ||
| - | |||
| - | If it doesn' | ||
| - | < | ||
| - | You might make it writable like this: | ||
| - | |||
| - | < | ||
| - | Or you can try removing it and let htop generate a new one, maybe the old one is corrupted somehow. | ||
| - | |||
| - | < | ||
| - | |||
| - | ====== Reconfigure python ====== | ||
| - | |||
| - | cd install dir and | ||
| - | < | ||
| - | |||
| - | ====== Synaptic lost quick index filter ====== | ||
| - | |||
| - | |||
| - | < | ||
| - | apt-get install apt aptitude synaptic --reinstall</ | ||
| - | | ||
| - | |||
| - | ====== Android Screen Saver Start Time ====== | ||
| - | |||
| - | You can customize the screen saver timeout via adb shell. To check what the screensaver is currently set to: | ||
| - | |||
| - | < | ||
| - | |||
| - | Return value is in milliseconds, | ||
| - | |||
| - | To set a new value (let's say 30 seconds, which is 30000 ms) | ||
| - | |||
| - | < | ||
| - | |||
| - | |||
| - | ====== Numlock on tty ====== | ||
| - | |||
| - | < | ||
| - | for t in / | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | ====== linux grub-install: | ||
| - | |||
| - | |||
| - | You need to change the label type, from boot to bios_grub for example through parted: | ||
| - | |||
| - | < | ||
| - | < | ||
| - | < | ||
| - | |||
| - | ====== Execute command before shutdown/ | ||
| - | |||
| - | < | ||
| - | ln -s / | ||
| - | chmod a+x / | ||
| - | |||
| - | |||