Skip to content

Latest commit

 

History

History
executable file
·
258 lines (210 loc) · 8.6 KB

File metadata and controls

executable file
·
258 lines (210 loc) · 8.6 KB

Linux notes

archlinux tips

  1. ~$:# fcitx export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS="@im=fcitx"
  2. ~$: vim ~/.xinitrc

export LC_ALL=zh_CN.UTF-8 export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=“@im=fcitx”

  1. find the fastest mirror

~$:sudo pacman-mirrors -gb testing -c China #chose region
~$:sudo pacman -Syyu #update

ubuntu tips

  1. auto find the best mirror base on your location (deb mirror) just add the code below to the top of your /etc/apt/sources

> deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse
  1. locale

~$: vim /etc/defalut/locale
~$: locale-gen
~$: locale -a
~$: locale
~$: sudo /usr/share/locales/install-language-pack en_US

enviromental variables

  1. declare (create a variables )

~$: declare { variables }

  1. set (show all variables of current shell)

~$: set

  1. env(show variables related to current user)

~$: env

  1. export (export variables )

~$: export

  1. location to save variables to make them permanent
    /etc/bashrc
    /etc/profile
  2. path

~$: echo $path
~$: PATH=$PATH:/home/shiyanlou/mybin (add path)
~$: echo "PATH=$PATH:/home/shiyanlou/mybin" >> .bashrc

search

  1. whereis
  2. locate

~$: locate /etc/sh (find all file or floder start with sh in /etc) locate /usr/share/\*.jpg (find all jpg file in /usr/share)

  1. which
  2. find

system management

  1. chown

~$: chown owner filename (change the owner of file)

  1. file (show the propetry of a file)

~$: file filename

  1. df

~$: df -h (check the storage)

  1. dd

~$: dd if=... (input file is) of=... (output file is) bs=num (block size num+unit{unit:Byte is default ,can be K M G etc} ) count=num(the number of bs)

vim

  1. find && replace

:%s/str1/str2/g(equal to :g/str1/s//str2/g) replace all str1 to str2

tmux

  1. install Resurrect

~$:mkdir ~/.tmux ~$:cd ~/.tmux ~$:git clone https://github.com/tmux-plugins/tmux-resurrect.git ~$:run-shell ~/.tmux/tmux-resurrect/resurrect.tmux ~$:tmux source-file ~/.tmux.conf

  1. install Tmux Continuum

~$:mkdir ~/.tmux ~$:cd ~/.tmux ~$:git clone clone https://github.com/tmux-plugins/tmux-continuum.git ~$:run-shell ~/.tmux/tmux-continuum/continuum.tmux ~$:tmux source-file ~/.tmux.conf

image Tools

  1. jpegoptim (image optimization)

jpegoptim file

  1. optipng (image optimization)

optipng -o<0-7> filename #<0-7> is the optimization level

  1. ImageMagick (image tool)

SYNOPSIS

  convert input-file [options] output-file
     command- line.

     convert

            convert between image formats as well as resize an image,  blur,
            crop,  despeckle,  dither,  draw  on, flip, join, re-sample, and
            much more.

     identify

            describes the format and characteristics of one  or  more  image
            files.

     mogrify

            resize  an  image, blur, crop, despeckle, dither, draw on, flip,
            join, re-sample, and much more. Mogrify overwrites the  original
            image file, whereas, convert writes to a different image file.

     composite

            overlaps one image over another.

     montage

            create  a  composite image by combining several separate images.
            The images are tiled on the composite image  optionally  adorned
            with a border, frame, image name, and more.

     compare

            mathematically  and  visually annotate the difference between an
            image and its reconstruction..

     stream

            is a lightweight tool to stream one or more pixel components  of
            the image or portion of the image to your choice of storage for‐
            mats. It writes the pixel components as they are read  from  the
            input image a row at a time making stream desirable when working
            with large images or when you require raw pixel components.

     display

            displays an image or image sequence on any X server.

     animate

            animates an image sequence on any X server.

     import

            saves any visible window on an X server and  outputs  it  as  an
            image  file. You can capture a single window, the entire screen,
            or any rectangular portion of the screen.

     conjure

            interprets and executes scripts written in the Magick  Scripting
            Language (MSL).

SEE ALSO convert(1), identify(1), composite(1), montage(1), compare(1), dis‐ play(1), animate(1), import(1), conjure(1), quantize(5), miff(4)

  1. fbida (image viewer)

~$: fbi filename #view image file in tty

  1. fbgrab (grab image)

~$: fbgrab -h ... -w ... -s ... -f ... -f filename -h height -w width -s second

####the internet

  1. irssi

/network add -nick {yournick} Freenode /server add -auto -network Freenode irc.freenode.net 6667 /channel add -auto #channel Freenode password(if the channel require) /network add -autosendcmd "/^msg nickserv identify {yourpasswd};wait 2000" freenode ####compression and decompression

  1. zip

~$: zip -r (recursion) -x (1-9 compression level ) -q (quite) -e (encryption)-o (output) filename path -x (except) filename

  1. unzip

~$: unzip -q (quit) filename -d (decompression path) path ~$: unzip -l filename (just list the files in the compressed package)

  1. rar

~$: rar a(create) filename path ~$: rar d filename file (delete a file in package) ~$: rar l filename (just list)

  1. unrar

~$: unrar x filename (decompression)

  1. tar

~$: tar -cf filename path (create a package) ~$: tar -czf filename path (create a .tar.gz package) ~$: tar -cjf filename path (create a .tar.bz2 package) ~$: tar -cJf filename path (create a .tar.xz package) ~$: tar -xf filename -C path (decompress file to a specific directory) ~$: tar -tf (view the content of the package)

####ffmpeg 1.add subtitle to a movie

~$: ffmpeg -i filename.ssa[srt.etc.] filename.ass #transform subtitle files into ass format
~$: ffmpeg -i videofilename -vf "ass=subtitle.ass" output

2.transform mp3 to flac

bash shell code :
#/bin/sh
for f in .mp3
do
ffmpeg -i $f ${f%%.
}.flac
done

3.record Desktop shell

ffmpeg -f x11grab -s 1360x768 -r 60 -i $DISPLAY -c:v h264 -s 1360x768 a.mp4

others

  1. change default path of terminal

~$: vim ~/.bashrc add cd path

  1. git ssh

~$: git config --global user.name "username" ~$: git config --global user.email "[email protected]" ~$: ssh-keygen -t rsa -C “[email protected]” ~$: ssh [email protected]

  1. curl

~$: curl -f 'name=@filename' http://img.vim-cn.com/
#upload an image file(or anyother files) to http://img.vim-cn.com ~$: curl -v --data-urlencode 'content@/home/beval/Desktop/filename' -d 'poster=beval' 'syntax=text' http://paste.ubuntu.com/
~$: curl https://api.streamable.com/upload/ -u username:password -F 'name=@filename'

  1. system infomation

~$:head -n 1 /etc/issue #veiw system os info
~$:uname -a # view core/operat system/CPU info
~$:cat /proc/cpuinfo # view CPU info
~$:hostname # view hostname
~$:lspci -tv # list all pci devices
~$:lsusb -tv # list all usb devices ~$:lsmod # list all loaded core module ~$:free -m # view the free memory
~$:df -h #view the info of each partition ~$:du -sh filename # view the size of the file

  1. commend history

~$:sudo !! # execute the last command use root authority
~$:$!! # execute the last command

ctrl+r # shortcut for command fuzzy match

  1. github create a new repository on the command line

~$: echo "# self-learning" >> README.md
~$: git init
~$: git add README.md
~$: git commit -m "first commit"
~$: git remote add origin https://github.com/BevalZ/self-learning.git
~$: git push -u origin master