useful linux command

cmd1&&cmd2
cmd2||cmd2
/path/scriptname opt1 opt2 opt3
$0                        $1    $2               $@ $# $*
calculation: $((....))
逻辑表达式[ ]中 -a, -o ,-lt, ==, !=

cd 命令
cd /
cd ~
cd ../

查看文档
cat
more
vi

查看linux机器的各种信息
cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/version
cat /etc/issue
uname -a 查看位数

apt-get 命令
适用于deb包管理式的 操作系统 ,主要用于自动从互联网的 软件 仓库中搜索、安装、 升级 卸载 软件或操作系统
ssh name@remoteserver
ssh name@remoteserver -p 2222

scp
scp / home / daisy / full . tar . gz root@ 172.19 . 2.75 : / home / root
scp root@172.19.2.75:/home/root/full.tar.gz home/daisy/full.tar.gz

pscp
pscp d:\software\***.tgz root@192.***.**.**:/root/yts
pscp [options] [user@]host:source target

Reboot;
reboot

GCC
gcc --verison

.tar
tar xvf Filename

.tar.gz
tar zxvf Filename

mysql
service mysql stop
service mysql start

find
find <指定目录> <指定条件> <指定动作>
find . -name 'my*'


rm
rm -f 强制删除
rm -r 删除目录



sh -nvx 
echo;
read 
touch
date
declare
source 
test -option filename
file filename
filename restart
filename stop

awk
sed
grep

Disk space:
df -hl
du -h --max-depth=1 


Display
tail -f filename

Alias:
source /MSTR/.bashrc

Sleep:
sleep <n>s(mh);

cpu:
cat /proc/cpuinfo | grep processor(check how many cpus are running) 
for i in {32..79}; do echo ‘0’ > /sys/devices/system/cpu/cpu$i/online; done(turn off cpu 32-79, turn on echo '1')
mpstat -P ALL
物理 cat /proc/cpuinfo |grep "physical id" | sort |  unit 
逻辑cpu:cat /proc/cpuinfo |grep "processor"|wc -l
每个cpu的核数:cat /proc/cpuinfo |grep "cores"|uniq 

连接
netstat -an | awk '/^tcp/ {++S[$NF]};END {for(a in S) print a, S[a]}'
netstat -nat|grep -i "80"|wc -l

threads:
 /proc/sys/kernel/pid_max 
 /proc/sys/kernel/threads-max :q
 ulimit -u: the maximum number of processes available to a single user
 /proc/sys/vm/max_map_count
 pstree -p 3660 | wc -l  查询当前某程序的线程或进程数
 pstree -p | wc -l  查询当前整个系统已用的线程或进程数:

 
Clean memory cache:
echo 3 > /proc/sys/vm/drop_caches

Memory leak:

jstat -gcutil 29128 1000 1000

“env | grep –i hook”(If no result returned, it means the memory hook is not enabled. )

"export HOOK_ENABLED=1"(To enable Memory Hooking)
"export HOOK_STKDEPTH=8"(Set hooking call stack depth)
“H” -> “S"(start)
“H” -> ”D”(E)-> “S”(stop)cpui
Then objdump.txt, SymTab.txt and ModuleInfo.txt will be generated.
Leakfinder then we will get LeakCallStacks.txt file generated.

IServer crash:
ulimit -a
ulimit –c unlimited      MUST use in the console session
cat /proc/server_pid/limits(/etc/security/limits hard limit)
cat /proc/sys/kernel/core_pattern(core file's default path   change to core.%p)
gdb ./bin/MSTRSvr core.*
bt



pstack:
Linux, Solaris, HP-UX (on SUSE Linux replace 'pstack' with 'gstack'). Users should note that the pstack or gstack utilities may not be installed by default on the operating system. Users would need to contact their system administrators to obtain access to these utilities:
NOTE: 'ps axms' may not work on all installed versions of Linux, Solaris, or HP-UX. If the OS does not support these flags try using 'ps -ef' or 'ps -af'.
date > ${HOST}_pstack1; pstack [MPID] >> ${HOST}_pstack1
date > ${HOST}_psaxms1; ps axms >> ${HOST}_psaxms1
[WAIT 15 SECONDS]
date > ${HOST}_pstack2; pstack [MPID] >> ${HOST}_pstack2
date > ${HOST}_psaxms2; ps axms >> ${HOST}_psaxms2


Memory cache:
export MSTR_MEM_CACHE_MAX_TOTAL_SIZE = 21474836480 
export MSTR_MEM_CACHE_MAX_BLOCK_SIZE = 268435456
ulimit -c unlimited
(MSTR_MEM_CACHE_MAX_TOTAL_SIZE and MSTR_MEM_CACHE_MAX_BLOCK_SIZE  settings modification in file   ~/Linux/bin/mstrexec-iserver  and in file ~/Linux/env/Tunable.sh)
cat /proc/pid/environ(check the setting)

ps aux | grep MSTRSvr

tar zxvf mysql.tar.gz -C /home/aaa
scp:
scp local_file remote_username@remote_ip:remote_folder
scp root@www.cumt.edu.cn:/home/root/others/music /home/space/music/1.mp3SMt

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
vncserver

for i in `ls /home/awang/Delta/9.2.574.101/Linux/RELEASE/`; do mv $i `echo $i"_bak"`; done
the command to rename the original .so files

to see Linux version 32 or 64?
file /sbin/init

Object leak:
Reference count hooking:
We just need to use reference count hooking for this case. So you don’t need to set HOOK_ENABLED=1, just type H-R after server started.
And, set environment variable  MSTR_DISABLE_REF_TRACING =27 to trace document definition object only. This way may reduce the performance impact.

mount 10.27.6.10:/vol/hqhome/ctcuser/tiyu /home/tiyu

    # uname -a # ????/????/CPU??
    # head -n 1 /etc/issue # ????????
    # cat /proc/cpuinfo # ??CPU??
    # hostname # ??????
    # lspci -tv # ????PCI??
    # lsusb -tv # ????USB??
    # lsmod # ?????????
    # env # ????????
    # free -m # ??????????????
    # df -h # ?????????
    # du -sh # ?????????
    # grep MemTotal /proc/meminfo # ??????
    # grep MemFree /proc/meminfo # ???????
    # uptime # ???????????????
    # cat /proc/loadavg # ???????????/p
    # mount | column -t # ?????????
    # fdisk -l # ??????
    # swapon -s # ????????
    # hdparm -i /dev/hda # ??????(????IDE??)
    # dmesg | grep IDE # ?????IDE/c????????
    # ifconfig # ???????????
    # iptables -L # ???????
    # route -n # ?????
    # netstat -lntp # ????????
    # netstat -antp # ???????????
    # netstat -s # ??????????
    # ps -ef # ??????
    # top # ??????????
    # w # ??????
    # id # ????????
    # last # ????????
    # cut -d: -f1 /etc/passwd # ????????
    # cut -d: -f1 /etc/group # ???????
    # crontab -l # ?????????????
    # chkconfig –list # ????????
    # chkconfig –list | grep on # ?????????????
    # rpm -qa # ??????????cat
    cat /proc/cpuinfo :??CPU????
    cat /proc/partitions :???????
    cat /proc/meminfo :??????
    cat /proc/version :????,??uname -r
    cat /proc/ioports :????io??
    cat /proc/interrupts :????
    cat /proc/pci :??pci?????
    cat /proc/swaps :????swap?????
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值