Open directory

  • nautilus /path/to/folder

Delete

  • sudo rm /path/to/file
  • sudo rm -r /path/to/folder

Download

  • sudo wget http://url

Edit file

  • gedit file
  • vim file
  • nano file
  • vi file
  • echo some content > file

Create .desktop

  • sudo gnome-desktop-item-edit –create-new /path/to/file.desktop

Activate venv

  • source venv/bin/activate

Root

  • sudo su –
  • ls /

PTT

  • luit -encoding big5 telnet ptt.cc

Shortcut

  • alias rm=’rm -i’

Permission

  • chmod u+r file #user add read permission
  • chmod 764 file #user: rwx; group:rw; world: r

Print work directory

  • pwd

PATH

  • echo $PATH
  • export PATH=$PATH:path/to/add

FInd Program

  • which python
  • sudo find / -name “python” -print

Redirect

  • ls > ls.txt (rewrite)
  • ls >> ls.txt (append)
  • find / -name passwd -print 2>error.txt (redirect standard error to text file)

Grep

  • grep -r <–filename–> (The specific meaning of “recursive” in this context is “operating on a directory and its contents, including the contents of any subdirectories“.)
  • e.g. ls | grep “query” (pipe: take the previous command output and send to input of next command)
  • e.g. apt-cache search apache | grep python
  • e.g. ps aux | grep bash

Create Link

  • ln -s /usr/share/backgrounds mywallpapers (symbolic)

Compress

  • zip file.zip file1 file2 file3
  • unzip file.zip
  • tar cfz file.tar.gz file1 file2 file3 (create, filename, zip)
  • tar xfz file.tar.gz (extract, filename, zip)

Packages Management source: /etc/apt/source.list

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install software
  • sudo apt-get remove software
  • sudo apt-get autoremove (remove all unused/relevent software)
  • apt-cache search python

Log Management system log configs:

  • /etc/rsyslog.conf
  • /etc/rsyslog.d

log paths:

  • /var/log

Service Management service scripts path: /etc/init.d

  • sudo /etc/init.d/networking status
  • sudo service –status-all (+:running, -:stop, ?:disable/no status)
  • sudo service <–service name–> start

Remove program

  • sudo apt-get purge <-app->
  • sudo apt-get purge autoremove <-app->
  • sudo apt-get purge –auto-remove <-app->

Manual

  • man

Background Services / Processes

  • top (running process)
  • ps aux
  • ps aux | grep firefox

Kill Process

  • kill <-process id->
  • killall firefox

Build program

  • run configure to create Makefile => ./configure
  • run Makefile to compile => make
  • make install

Edit string

  • echo this is true | sed ‘s/true/false/’ => this is false

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。