Home tmade.de

Home Wiki

Commands

Misc

watch                              #Refresh any command (e.g "watch ls -al")
sfdisk -R /dev/xxx                 #Reload Kernel Partitiontable
strace -p PID                      #Debug System Prozesses
info                               #Shows system command overview
cat /proc/filesystems              #Shows supported filesystems
ls -l /dev/disk/by-path/
ls -l /dev/disk/by-uuid/
ls -l /dev/disk/by-label/
cat /dev/debug                     #Debug output for devices
tload                              #Overview Systemload (like top)
vmstat                             #Show I/O (vmstat 1 = 1-sec. update)
hwinfo --gfxcard                   #Graficcard info
hwinfo --help                      #Display options about hardware info
glxinfo | grep direct              #Display info about a GLX extension and OpenGL renderer
file                               #Show file information
dos2unix                           #Change file format from dos to unix
command1 && command2               #Command2 is only executed if command1 completed without errors
command1 || command2               #Command2 is only executed if command1 completed with an error
kdesu kwrite /path/to/file         #Open kwrite as superuser
env                                #Show Environment Variables
env | grep -i _proxy= | sort
locale                             #Show language settings (german: LANG="de_DE.UTF-8", english: LANG="en_US.UTF-8", change: export LANG="en_US.UTF-8")
echo "" > file                     #Empty file on the fly (delete big log files without interruption)
loadkeys de                        #Set keyboardlayout to german keyboard
date +%T -s "10:13:13"             #Set time
date +'%H%M%S%N'                   #Get date for a timestamp (e.g."104304330764740") with milliseconds at the end
du -a / | sort -n -r | head -n 30  #Find 30 biggest files in /
du -mx / | sort -rn -k1 | head                                                                                 #Stay on filesystem for mount "/" and show usage sorted by size  
find -P /  -mindepth 1 -maxdepth 1 ! -fstype nfs  ! -type l | xargs  du -xsm |  awk '{print $1"\t"$2 ;s+=$1} END {print "SUM:\t"s}'                                     
for i in /var/*; do echo $i; find $i |wc -l; done                                                              #count i-nodes in "/var"
du -h  $(ls) > /root/size                                                                                      #Pipe each file in actual folder + cumulated filesize into file "size"
du -h | sort -n > filesize                                                                                     #Pipe filesize incremental sorted into file "filesize"
top / ps :
ps afwwwwxo user,pid,%cpu,%mem,vsz,rss,wchan=WIDE-WCHAN-COLUMN,stat,start,cputime,comm
ps faxw
ps -ef | grep servicename
for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null                #Check how many files, symlinks and folders in a directory (recursive)
for t in files links directories; do echo `find . -maxdepth 1 -type ${t:0:1} | wc -l` $t; done 2> /dev/null    #Check how many files, symlinks and folders in a directory (not recursive)
grep "^[^#;]" test.conf                                                                                        #Showing just lines beginning without "#" from file test.conf
p3=$(/bin/ps -ef |grep  "searchstring" |grep -v grep |rev |cut -d " " -f 1 |rev)
p1=$(ps -C process_name -o cmd |grep "searchstring")
w3m http://hostname/repo
wget --backups=1 https://domain.com
ifconfig -a | awk '/inet 10/{print $2}'

systemrescourcen/ performance:

tload			//systemauslastung
ps -ef		//show current process
top			// (mit F umschalten, dann z.B. "n" für memory utilization
vmstat 1 		// (activity of swap memory - aktualisierung sekundenweise)
free			//show current utilization of physical and swap memory
iostat			//package "sysstat" muss installiet werden!!
iostat -x 1 /dev/hda	//sekuendliche aktualisierung von /dev/hda
ksysguard		//taskmanager fuer linux (package kdebase3)

Who's logged in

finger
who
last

System Message

To all logged in users:

echo "SYSTEM BEING SHUT DOWN IN 5 MINUTES" | wall

Argument list too long

Various trouble-shooting options:

setfacl

for i in `find -name "*.gz"` ; do setfacl -m g:groupname:rw- $i; done

tar

find . -name "*.log" -print > ./allfiles && find . -name "*.gz" -print >> ./allfiles && find . -name "*.tgz" -print >> ./allfiles
tar -czf `date +%A`.tgz --files-from ./allfiles

Without temp file (allfiles):

find . -name "*.log" |tar czf `date +%A`.tgz -–files-from -

rm

find . -name "*.gz" | xargs /bin/rm
linux/commands.txt · Last modified: 2021/03/05 13:14 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki