#命令模式下输入:光标移动到第34行第15个字符
ctrl+u删除光标前面的字符
ctrl+j删除光标后面的字符
在Linux下用VIM打开大小几个G、甚至几十个G的文件时,是非常慢的。
这时,我们可以利用下面的方法分割文件,然后再打开。
1 查看文件的前多少行
head -10000 /var/lib/mysql/slowquery.log > temp.log
上面命令的意思是:把slowquery.log文件前10000行的数据写入到temp.log文件中。
2 查看文件的后多少行
tail -10000 /var/lib/mysql/slowquery.log > temp.log
上面命令的意思是:把slowquery.log文件后10000行的数据写入到temp.log文件中。
3 查看文件的几行到几行
sed -n '10,10000p' /var/lib/mysql/slowquery.log > temp.log
上面命令的意思是:把slowquery.log文件第10到10000行的数据写入到temp.log文件中。
acmer之ubuntu下安装Eclipse(附有CB16.01的安装和chrome的安装)
发现孤儿进程的ppid并不等于1,是967,这个967是桌面的祖先进程
管道(pipe),流管道(s_pipe)和有名管道(FIFO)
信号(signal)
消息队列
共享内存
信号量
套接字(socket)
1. 临界区(Critical Section):适合一个进程内的多线程访问公共区域或代码段时使用
2. 互斥量 (Mutex):适合不同进程内多线程访问公共区域或代码段时使用,与临界区相似。
3. 事件(Event):通过线程间触发事件实现同步互斥
4. 信号量(Semaphore):与临界区和互斥量不同,可以实现多个线程同时访问公共区域数据,原理与操作系统中PV操作类似,先设置一个访问公共区域的线程最大连接数,每有一个线程访问共享区资源数就减一,直到资源数小于等于零。
ctrl+alt+F1进入字符界面,再次运行刚才程序,出现了结果,ppid=1.
ctrl+alt+F7进入图形界面,就可以继续愉快的图形界面了
pwd:print work directory 打印当前目录 显示出当前工作目录的绝对路径
ps: process status(进程状态,类似于windows的任务管理器)
netstat -s命令
[root@server ~]# netstat -s | egrep "listen|LISTEN" 667399 times the listen queue of a socket overflowed 667399 SYNs to LISTEN sockets ignored
比如上面看到的 667399 times ,表示全连接队列溢出的次数,隔几秒钟执行下,如果这个数字一直在增加的话肯定全连接队列偶尔满了。
[root@server ~]# netstat -s | grep TCPBacklogDrop 查看 Accept queue 是否有溢出
ss命令
[root@server ~]# ss -lnt State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 :6379 : LISTEN 0 128 :22 : 如果State是listen状态,Send-Q 表示第三列的listen端口上的全连接队列最大为50,第一列Recv-Q为全连接队列当前使用了多少。 非 LISTEN 状态中 Recv-Q 表示 receive queue 中的 bytes 数量;Send-Q 表示 send queue 中的 bytes 数值。
十个提高效率的命令别名
#解压
alias untar='tar -zxvf '
#支持断点下载
alias wget='wget -c '
#生成一个 个字符的随机数密码
alias getpass="openssl rand -base64 20"
#校验checksum
alias sha='shasum -a 256 '
#正常下无数次,可以设置一个合理次数
alias ping='ping -c 5'
#启动web服务器进行测试
alias www='python -m SimpleHTTPServer 8000'
#网速测试,需要下载
alias speed='speedtest-cli --server 2406 --simple'
#查看公网IP
alias ipe='curl ipinfo.io/ip'
#查看局域网IP
alias ipi='ipconfig getifaddr en0'
#清屏,可以ctrl+L,
alias cls='clear'
常用参数:-auxf
ps -auxf 显示进程状态
df: disk free 其功能是显示磁盘可用空间数目信息及空间结点信息。换句话说,就是报告在任何安装的设备或目录中,还剩多少自由的空间。
du: Disk usage
rpm:即RedHat Package Management,是RedHat的发明之一
rmdir:Remove Directory(删除目录)
rm:Remove(删除目录或文件)
cat: concatenate 连锁
cat file1file2>>file3 把文件1和文件2的内容联合起来放到file3中
insmod: install module,载入模块
ln -s : link -soft 创建一个软链接,相当于创建一个快捷方式
mkdir:Make Directory(创建目录)
touch
man: Manual
su:Swith user(切换用户)
cd:Change directory
ls:List files
ps:Process Status
mkdir:Make directory
rmdir:Remove directory
mkfs: Make file system
fsck:File system check
uname: Unix name
lsmod: List modules
mv: Move file
rm: Remove file
cp: Copy file
ln: Link files
fg: Foreground
bg: Background
chown: Change owner
chgrp: Change group
chmod: Change mode
umount: Unmount
dd: 本来应根据其功能描述“Convert an copy”命名为“cc”,但“cc”已经被用以代表“CComplier”,所以命名为“dd”
tar:Tape archive (磁带档案)
ldd:List dynamic dependencies
insmod:Install module
rmmod:Remove module
lsmod:List module
文件结尾的"rc"(如.bashrc、.xinitrc等):Resource configuration
Knnxxx /Snnxxx(位于rcx.d目录下):K(Kill);S(Service);
nn(执行顺序号);xxx(服务标识)
.a(扩展名a):Archive,static library
.so(扩展名so):Shared object,dynamically linked library
.o(扩展名o):Object file,complied result of C/C++ source file
RPM:Red hat package manager
dpkg:Debian package manager
apt:Advanced package tool(Debian或基于Debian的发行版中提供)
部分Linux命令缩写
bin = Binaries (二进制文件)
/dev = Devices (设备)
/etc = Etcetera (等等)
/lib = LIBrary
/proc = Processess
/sbin = Superuser Binaries (超级用户的二进制文件)
/tmp = Temporary (临时)
/usr = Unix Shared Resources
/var = Variable (变量)
FIFO = First In, First Out
GRUB = GRand Unified Bootloader
IFS= Internal Field Seperators
LILO = LInux LOader
MySQL = My 是最初作者女儿的名字,
SQL = Structured QueryLanguage
PHP = Personal Home Page Tools = PHP HypertextPreprocessor
PS = Prompt String
Perl = "Pratical Extraction and Report Language"(实际的抽取和报告语言) ="Pathologically Eclectic Rubbish Lister"
Python 得名于电视剧Monty Python's Flying Circus
Tcl = Tool Command Language
Tk = ToolKit
VT = Video Terminal
YaST = Yet Another Setup Tool
apache = "a patchy" server
apt = Advanced Packaging Tool
ar = archiver
as = assembler
awk = "Aho Weiberger and Kernighan"三个作者的姓的第一个字母
bash = Bourne Again SHell
bc = Basic (Better) Calculator
bg = BackGround
biff = 作者HeidiStettner在U.C.Berkely养的一条狗,喜欢对邮递员汪汪叫。
cal = Calendar (日历)
cat = Catenate (链接)
cd = Change Directory
chgrp = Change Group
chmod = Change Mode
chown = Change Owner
chsh = Change Shell
cmp = compare
cobra = Common Object Request BrokerArchitecture
comm = common
cp = Copy
cpio = CoPy In and Out
cpp = C Pre Processor
cron = Chronos 希腊文时间
cups = Common Unix Printing System
cvs = Current Version System
daemon = Disk And Execution MONitor
dc = Desk Calculator
dd = Disk Dump (磁盘转储)
df = Disk Free
diff = Difference
dmesg = diagnostic message
du = Disk Usage
ed = editor
egrep = Extended GREP
elf = Extensible Linking Format
elm = ELectronic Mail
emacs = Editor MACroS
eval = EVALuate
ex = EXtended
exec = EXECute (执行)
fd = file descriptors
fg = ForeGround
fgrep = Fixed GREP
fmt = format
fsck = File System ChecK
fstab = FileSystem TABle
fvwm = F*** Virtual Window Manager
gawk = GNU AWK
gpg = GNU Privacy Guard
groff = GNU troff
hal = Hardware Abstraction Layer
joe = Joe's Own Editor
ksh = Korn SHell
lame = Lame Ain't an MP3 Encoder
lex = LEXical analyser
lisp = LISt Processing = Lots of IrritatingSuperfluous Parentheses
ln = Link
lpr = Line PRint
ls = list
lsof = LiSt Open Files
m4 = Macro processor Version 4
man = MANual pages
mawk = Mike Brennan's AWK
mc = Midnight Commander
mkfs = MaKe FileSystem
mknod = Make Node
motd = Message of The Day
mozilla = MOsaic GodZILLa
mtab = Mount TABle
mv = Move
nano = Nano's ANOther editor
nawk = New AWK
nl = Number of Lines
nm = names
nohup = No HangUP
nroff = New ROFF
od = Octal Dump
passwd = Passwd
pg = pager
pico = PIne's message COmposition editor
pine = "Program for Internet News &Email" = "Pine is not Elm"
ping = 拟声 又 = Packet Internet Grouper
pirntcap = PRINTer CAPability
popd = POP Directory
pr = pre
printf = Print Formatted
ps = Processes Status
pty = pseudo tty
pushd = PUSH Directory
pwd = Print Working Directory
rc = runcom = run command, rc还是plan9的shell
rev = REVerse
rm = ReMove
rn = Read News
roff = RunOFF
rpm = RPM Package Manager = RedHat PackageManager
rsh, rlogin, rvim中的
r = Remote
rxvt = ouR XVT
seamoneky = 我
sed = Stream Editor
seq = SEQuence
shar = Shell ARchive
slrn = S-Lang rn
ssh = Secure Shell
ssl = Secure Sockets Layer
stty = Set TTY
su = Substitute User
svn = SubVersion
tar = Tape ARchive
tcsh = TENEX C shell
tee = T (T形水管接口)
telnet = TEminaL over Network
termcap = terminal capability
terminfo = terminal information
tex = τέχνη的缩写,希腊文art
tr = traslate
troff = Typesetter new ROFF
tsort = Topological SORT
tty = TeleTypewriter
twm = Tom's Window Manager
tz = TimeZone
udev = Userspace DEV
ulimit = User's LIMIT
umask = User's MASK
uniq = UNIQue
i = VIsual = Very Inconvenient
vim = Vi IMproved
wall = write all
wc = Word Count
wine = WINE Is Not an Emulator
xargs = eXtended ARGuments
xdm = X Display Manager
xlfd = X Logical Font Description
xmms = X Multimedia System
xrdb = X Resources DataBase
xwd = X Window Dump
yacc = yet another compiler compiler
Fish = the Friendly Interactive SHell
su = Switch User
MIME = Multipurpose Internet Mail Extensions
ECMA = European Computer ManufacturersAssociation
手机扫一扫
移动阅读更方便
你可能感兴趣的文章