Friday, April 24, 2015

Shell vs. Term vs. eshell in Emacs

shell is the standard emacs interface to Operating System's command line interface.
term (ansi-term is pretty much same to term today. They were different packages, but now both defined in term.el) is a terminal emulator. It behaves like a dedicated terminal app, such as {xterm, gnome-terminal, puTTY}. It is compatible to more shell apps than emacs shell interface, but standard emacs keys such as moving cursor don't work here (because it is emulating a terminal.)
eshell is a shell written entirely in emacs lisp. Note: it is not a bash emulator. Eshell is a shell by itself, but similar to bash or other shells.
Which should you use?
It depends on your preference.
shell is good for general use of classic/standard unix shell commands, such as {grep, du, ls, sort, cat, head, tail, uname, …}.
term & ansi-term are good if you want to run stuff like ssh, or other command line interactive interface (such as {python, ruby, lisp} shell), or text based GUI app such as {vim, synaptic, …}.
eshell is good especially on Microsoft Windows where bash is not installed, or, if you are a emacs lisp programer, because eshell has direct access to emacs lisp.

Labels: , , ,

Friday, October 31, 2014

Linux Tools and Setup

Helpful Tools

  • Meld for file comparison, with GUI, easier to use than Linux Diff
  • Tmux 
  • I3 Window Manager
  • htop - an interactive process viewer for linux

Linux Issues and configuration

  • lUbuntu disable screen lock: sudo rm /etc/xdg/autostart/light-locker.desktop
  • Emacs <Ctrl>-<Spc> not function
    • sudo apt install dconf-editor, Then browse to Desktop >> ibus >> hotkey. The trigger and triggers setting will still show 'control+space'. Edit these settings out, being careful to leave empty brackets [] in triggers.
  • Grub boot order change:
    • sudo add-apt-repository ppa:danielrichter2007/grub-customizer
    • sudo apt-get update
    • sudo apt-get install grub-customizer
  • Undelete 
    • Looking for: extundelete - utility to recover deleted files from ext3/ext4 partition
    • To find such a package, you can try: apt-cache search undelete
    • To use the utility install it with: sudo apt-get install extundelete
    • After installation invoke man extundelete and study it carefully
      • extundelete --restore-file /opt/andy/bin/clean-bin-dir /dev/sda5
      • extundelete --restore-directory /opt/andy/bin/clean-bin-dir /dev/sda5
  • replace rm with trash
    • rm is dangerous operation, and it's hard to restore deleted file. Solution: trash-cli:
    • another options is to use gvfs
    • alias rm=trash, but trash don't support delete folder
  • Linux replace in all files
    •  .
  • Linux Commands
    •  tar -cvf files.tar my_directory --remove-files

Misc:

  • Bash (Unix shell) wiki 
  • find and replace: find . -name Makefile.POSIX -exec sed -i 's/CCFLAGS += -O3/CCFLAGS += -O0/' {} +
  • How use CUT -d 'delimiter' is delimiter is a TAB?   cut -d "<CTR>v <TAB>"

Top 5 Things to Do After Installing Fedora 22 Workstation

  • Software & Update
    • Canonical Partners is checked.
  • Step1
    • sudo yum update
  • Step 2: Configure Gnome Shell Interface
    • sudo yum install gnome-tweak-tool
  •  2. Enable RPM Fusion Repository
    • sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-21.noarch.rpm
    • sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-free-release-21.noarch.rpm
    • sudo yum update
  •  Install VLC Media Player
    • sudo yum install vlc
  • sudo yum install yum-plugin-fastestmirror

Labels: , , ,