Onion Information
Useful Linux Commands
Hidden Wonders - Useful Linux Commands - Lastmod: 2024-10-15 - A list of Linux commands I like. I update regularly. It’s more for myself than for anyone else, but I’d be happy if someone else found this page useful. Core Utils [#] - vim [#]...
Onion Details
Page Clicks: 0
First Seen: 03/11/2024
Last Indexed: 10/22/2024
WARNING
This Domain Has Been Reported 1 Time!
Human Trafficking: 1
Onion Content
Hidden Wonders Useful Linux Commands Lastmod: 2024-10-15 Table of Contents A list of Linux commands I like. I update regularly. It’s more for myself than for anyone else, but I’d be happy if someone else found this page useful. Core Utils [#] # Show total disk usage df -h # Shows disk usage of current directory (below two commands are equivalent) du -h --max-depth= 0 du -hs # My usual grep incantation to find some string in a codebase: # -R = recursively search all subdirectories # -n = output line number of the file # -i = ignore case grep -Rni $string $project_directory # Gets full path of a file, including the file itself realpath [file] vim [#] # Opens vim in vertical split mode vim -O # Opens vim in horizontal split mode vim -o # Opens vim with tabs for each file (though it's better to use buffers) vim -p File Transfer [#] Below is the script I use to update this website, using rsync: #!/bin/sh SERVER_DIR =/path/to/server_dir #No trailing slash here ADDRESS = "username@hiddenwonders.xyz" hugo && rsync -uvrP --delete-after "public/" $ADDRESS : $SERVER_DIR CD/DVD related commands [#] What is the point of this? Well, some old computers cannot boot from USB so--unless you have a floppy disk laying around--DVD is your best bet. Also, .iso files are nice for preserving old CDs. # Mounts .iso file to a directory mount /path/to/iso /path/to/empty/directory -o loop # Ejects physical disk (surprised how simple it is) eject # Blanks a RW DVD xorriso -outdev /dev/sr0 -blank as_needed # Burns .iso to blank disk (CD drive is usually /dev/sr0) xorriso -as cdrecord -v -sao dev =/dev/sr0 /path/to/iso base64 encode/decode [#] Using online base64 encoders/decoders is lame. # encode echo "base64 text" | base64 # decode echo "YmFzZTY0IHRleHQK" | base64 -d FFmpeg (a lot on encoding webms) [#] # Crops an image ffmpeg -i $input -vf crop = $height : $width : $start_height : $start_width $output # Reduce image size (https://stackoverflow.com/a/28806881) ffmpeg -i $input -vf scale = $width : $height $output # Reduce image size, using whatever width value preserves the aspect ratio ffmpeg -i $input -vf scale =-1: $height $output # Screen records (may require X11, also no audio) ffmpeg -r 24 -f x11grab -i :0.0 -c:v libx264rgb -preset ultrafast ~/rec- $( date +%s ) .mkv # Trim video or audio file to certain start and stop interval (https://unix.stackexchange.com/a/302469) ffmpeg -i $input -ss 00:00:20 -to 00:00:40 -c copy $output ffmpeg -i [image] -i [audio] -c:v libvpx-vp9 -r [framerate] -c:a opus -strict experimental output.webm makes a vp9 encoded webm from an image and an opus file. cpu-used 6 sets certain number of cpu cores to be used, makes encoding a lot quicker. speed 0 slightly slower encode, slightly higher quality. vbr on variable audio bit rate, saves space with worse audio quality. an stripes out audio from video. ffmpeg -i [file] -metadata title="Title" -c:v copy -c:a copy -c:s copy output.webm sets title metadata for a webm without reencoding. more ffmpeg docs for vp9 encoding options Additional 2 examples: ffmpeg -loglevel info -i $sourcefile -c:v libvpx-vp9 -ss $starttime -to $endtime -vf scale=$resolution: 1$subs$transpose -sn -b:v $size*1024*1024*8/$time*0.975 -quality best -r $FPS -threads $(nproc) -slices 8 -auto-alt-ref 1 -lag-in-frames 25 $audio -pass 2 $outputfile.webm ffmpeg -i "input.mp4" -c:v libvpx-vp9 -sn -b:v 250k -title-columns 1 -row-mt 1 -an "output.webm" mpv [#] # Play a file at location copied to clipboard (could be a url) mpv $( xclip -o ) youtube-dl/yt-dlp [#] -o "%(playlist_index)s %(track)s.%(ext)s" for format specifiers I use for downloading music, playlist_index pads 0s. ( source ) -x --audio-format best for downloading best available audio format. F to see available video and audio file qualities. f best to download best quality available, can specify using numbers from -F output. Other useful flags I like: -embed-metadata --embed-thumbnail Useless Linux Commands [#] # Makes music echo "g(i,x,t,o){return((3&x&(i*((3&i>>16?\"BY}6YB6%\":\"Qj}6jQ6%\")[t%8]+51)>>o)) >14,12)+g(i,s=i>>17,n^i>>13,10)+g(i,s/3,n+((i>>11)%3),10)+g(i,s/5,8+n-((i>>10)%3),9));}" |gcc -xc -&&./a.out|aplay # Makes random music hexdump -v -e '/1 "%u\n"' /dev/urandom | awk '{ split("0,27,5,67,13,18,55,666,12,000",a,","); for (i = 0; i < 1; i+= 0.0001) printf("%08X\n", 70*sin(100*exp((a[$1 % 12]/24)*log(12))*i)) }' | xxd -r -p | aplay -c 1 -f S32_LE -r 66665 Home Top Site Licensing Site last updated: 2024-10-15