linux cheat sheet

linux cheat sheet

change password of specific user
sudo passwd userNameHere

ip information
ip addr show show all ip address

tail -f your.log live-updating log file open in terminal

linux versions
cat /etc/SuSE-release opensuse
lsb_release -r ubuntu
cat /etc/issue ubuntu

working with processes
killall NAMEOFPROCESS killed specified process

working with files
touch emptyfile.type create an empty file
echo "testfile content add as line" >> testfile.test add a line at the end of the file
ln -s LINKED_PATH LINK_PATH create soft/symbolic link

working with directories
du -sh DIRECTORY_NAME size of directory/folder

installing LXDE desktop on ubuntu 14.04 lts is very simple
sudo apt-get update update list
sudo apt-get install lxde
Logout and login with LXDE -> Enjoy your Ubuntu 14.04 with LXDE
how to take screenshots with LXDE
sound preferences in LXDE

show archive content
tar -tvf file.tar list the contents of a tar file
tar -ztvf FILENAME.tar.gz list the contents of a tar.gz file
tar -jtvf file.tar.bz2 list the contents of a tar.bz2 file
-z uncompress the resulting archive with gzip
-x extract to dist from the archive
-v produce verbose output
-f rear the archive from the specified file

pack archive
tar cvzf FILENAME.tar.gz sourcedirectory
tar cvjf FILENAME.tar.bz2 sourcedirectory

unpack archive
tar -zxvf FILENAME.tar.gz extract tar.gz. file
tar -xjvf FILENAME.tar.bz2 extract/unpack .tar.bz2 (bzip2) file

installing software in opensuse
zypper search packagename
zypper install packagename
zypper remove packagename

CPU information | count of local CPU cores
grep processor /proc/cpuinfo
grep 'cores' /proc/cpuinfo | sort -u
cat /proc/cpuinfo

cpu load usage
mpstat -P ALL 20 update every 20sec | in package sysstat

lsusb -tv or lsblk list of hdd/usb

FORMAT usbpen with EXT3(LINUX)/FAT32(WINDOWS+LINUX)[max size about 4GB!]/NTFS(WINDOWS+LINUX) and lable
df -l or lsblk
umount device
install for arch sudo pacman -S dosfstools ntfsprogs
mkfs.ext3 /dev/sdb3 or mkfs.vfat /dev/sdb2 or mkfs.ntfs /dev/sdb2
e2label /dev/sdb3 USB_LABEL_EXT3 or mlabel -i /dev/sdb3 ::USB_LABEL_FAT
dosfslabel /dev/sdc1 "NEW_LABEL" or ntfslabel /dev/sdb3 USB_LABEL_NTFS

create bootable USB stick
find a usb pen for example with lsblk and umount it sudo umount /dev/sdb1.
change directory where is *.iso file and make a bootable usb with this command
sudo dd if=ARCHLINUX.iso of=/dev/sdb bs=1M
sudo eject /dev/sdb1

by error:
Total number of sectors (7733248) not a multiple of sectors per track (63)!
add mtools_skip_check=1 to your .mtoolsrc file to skip this test with echo mtools_skip_check=1 >> ~/.mtoolsrc

ZIP Files

find files in depth of 3 sub-folders with file name READ and search for word pjotr inside the files
find -type f -maxdepth 3 -name "*READ*" | xargs grep "pjotr"
find -perm 777 find all the files and directories which holds the 777 permission
find /path/where/to/look/up -name "dir-name-here" find a folder

output to file
some output command > FILENAME example ls -l > LS_MY_COMPUTER.TXT
some output command >> FILENAME append data to a file. example echo "this string will be at the end of FILE.TXT">> FILE.TXT

iso images
sudo mount -o loop /path/to/image.iso /media/mountpoint
md5sum image.iso

displaying process information
top running processes + u USERNAME for USERNAME
htop running processes + u to select certain user
ps aux all processes
ps -ef | grep username for certain user
ps aux | awk '$2 == PID number for a process { print $0 }'
ps --headers aux |head -n 1 && ps aux | awk '$2 == 1 { print $0 }'
or ps --headers aux |head -n 1; ps aux | awk '$2 == 1 { print $0 }'

killing processes
kill 123456 kill process with PID 123456
pkill -u USERNAME kill all processes of USERNAME

output only file names
find ./ -printf "%f\n"
for n in *; do echo "$n"; done
ls -lA | gawk -F':[0-9]* ' '/:/{print $2}'

Edit > Profile Preferences > Scrolling > Unlimited in ubuntu unlimited scroll back
Edit > Display > Scrollback lines max 100.000 in LXTerminal

LINOXIDE.COM linux-cheat-sheet