Skip to content

Instantly share code, notes, and snippets.

@ZhangMenghe
Last active March 31, 2020 22:50
Show Gist options
  • Select an option

  • Save ZhangMenghe/4d895573ece4f3b5a5f1c777c8592eb8 to your computer and use it in GitHub Desktop.

Select an option

Save ZhangMenghe/4d895573ece4f3b5a5f1c777c8592eb8 to your computer and use it in GitHub Desktop.
Linux Cheatsheet

Basics

  • ls dir file listing -al - with hidden files
  • rm del -r to remove directory, -f = shift+del
  • cp srcFile dstDir copy file to dstDir with same name, -r cp directory
  • mv srcFile dstFile move or rename

System

  • alias see all alias

  • change alias or export permanatly

    sudo vim ~/.bashrc
    sudo vim ~/.bash_aliases
    
    #update bashrc
    source ~/.bashrc
  • sudo without passward

    sudo visudo
    username ALL=(ALL) NOPASSWD:ALL

Open From Terminal

  • xdg-open $file open files in graphical applications, or use urlxdg-open http://askubuntu.com/

git

  • delete branch: locally git branch -D branch_name remotely:git push <remote_name> --delete <branch_name>

  • git merge develop merge develop changes to current withou modifying develop

  • Avoid commits on my branch interlace with other people's commit? Merge pull request without merge commits

        git checkout mybranch
        git rebase master #now all changes of master are merged into mybranches
        git checkout master
        git merge --ff-only mybranch
  • check/update remote upstream: git remote -v
    $ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

Install google pinyin in Ubuntu 16.04

  1. Command line: sudo apt-get install fcitx-googlepinyin
  2. System settings -> Language support -> Keyboard input method system, change to fcitx.
  3. Log out log in
  4. At top right, click the penguin icon -> Text entry setting
  5. Click +
  6. Search ‘Google’, find ‘Google Pinyin (Fcitx)’ 7, Use ‘Ctrl+space’ to switch between input methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment