Using Arch
cd - //cd to the former directory
ls -lh //there are the size of each file( not include the file in dir, so the dir is very small), and 'h' is used to convert it into format that easy to recognize
du -sh <dir> //check the size of dir. Without '-sh', you will get the content of the dir as well as the size of it.
acpi -i //Check the battery state. The files can be found in /sys/class/power_supply/BAT1/
makepkg -s //package files which contains a .pkgbuild file to a package, .pkg.tar.xz. To install .pkg.tar.xz, type:
pacman -U xxx.pkg.tar.xz //this will install at the same time as checking dependences and try to install them automaticly
usermod -a -G vboxusers hebi //
alsamixer //configure alsa, which determin the sound output
pacman -U /home/user/ceofhack-0.6-1-x86_64.pkg.tar.gz //Install ceofhack-0.6-1-x86_64 package from a local file.
pacman -Ss xxx //Search for regexp "xxx" in package database
pacman -Syu //update packages
pacman -S xxx //install by pacman
df -h //show memory state in M or G, instead of K
mount -a //remount the disk in /etc/fstab
lsblk //check disks and its mount place, it can also be used as "lsblk /dev/sda"
dhcpcd //start dhcp service, it must be active to use wired network. Sometimes it should be "dhcpcd wlan0" for wifi. See another blog for detail.
su -c "<command>" root //command as root
sudo //need to be installed //the command to config it: "export SUDO_USER=hebi", and the file /etc/sudousr must be modefied, since there is root ALL(ALL) ALL, there shuold be also hebi ALL(ALL) ALL
pkill x //do in tty2 can kill the job X in tty1
lspci //list pci device, often used as: "lspci | grep -i net"
lsusb //list usb device
lsblk //list blocks
Using Ubuntu
sudo fdisk -l //there must be sudo, or will show nothing. mmc/sd is not sdx, but mmcblk0
cdrecord -scanbus //scan device
cdrecord -v -eject speed=2 dev=2,0,0 xxx.iso //speed=2 means 2x, which is about 2mbps, dev is what I get in -scanbus.
UNTARS
tar zxvf xxx.tar.gz
tar zcvf xxx.tar.gz <dictyionary> //tar it, it can be ./Document/*.txt
gunzip *.gz
tar jxvf xxx.tar.bz2
7za x xxx.7z //use x to extract to a dirction called xxx, but use e means to extract here
PACKAGE INSTALL
dpkg -L xxx //check install position.
whereis <command>
sudo rmmod psmouse //forbid touch tablet
sudo modprobe psmouse //start touch tablet
sudo su //as root
SESSIONS AND JOBS
setsid commands //start a new session
ps -ef //check all sessions
kill <pid> //kill session by pid
commands & //run background
jobs //check jobs in this terminal(session)
kill %n //kill the number n jobs( 1, 2, ...)
source <filename> //let the file to be active now without necessary to reboot. e.g. source ~/.bashrc
uname -ra //check system information
unzip -0 CP936 xxx.zip //this command is used for the messy code when double click .zip file to unzip it when its title is Chinese. CP936 may also be GBK or GB18030. The name is right, but the context is messy yet.
ABOUT FIND
unrar e <file> //also use for the messy code
find ./ -name xxx //search ./ and its children dir for the file or dictionary whose fullname is xxx
find -maxdepth 1 -name "abc*" //search current path for the regular expression named "abc*" with depth 1
sudo apt-get update //update the apt-get list
sudo apt-get upgrade //update all the updates
sudo apt-get remove wine* //remove the apts. Be careful! When I use this to uninstall wine, I find it also remove lots of softwares including ibus, virtualbox, kconsole, kfmclient and so on, which I really DO NOT want to lose. Fortunatly, I didn't use the following command:
sudo apt-get remove --purge wine* //remove the configure of the apts at the same time. Since I donot use this para, when I reinstall vbox, I find all my data was just there.
date //current time and date
cal //calendar
浙公网安备 33010602011771号