
Unix&Linux
文章平均质量分 62
juliosun
这个作者很懒,什么都没留下…
展开
-
vscode一次打开所有相同文件名的文件
only want to open files with certain name:find . -iname CMakeLists.txt | xargs codewith containing lines:grep -l "<Icon" * | xargs code原创 2020-04-27 21:41:53 · 1394 阅读 · 0 评论 -
Unix 移动所有子目录下文件到文件夹
you can use find withxargsfor thisfind /thisdir -type f -name "*.ogg" -print0 | xargs -0 -Imysongs mv -i mysongs /somedirThe -I in the above command tells xargs what replacement string you want...原创 2020-04-12 23:49:39 · 562 阅读 · 0 评论 -
怎样给Ubuntu增加swap虚拟内存空间
From Ubuntu 18.04 onwards, a swapfile rather than a dedicated swap partition is used (except when LVM is used). The swap file is named "swapfile". To change the size of this swap file: Disable the ...原创 2020-03-20 07:48:17 · 408 阅读 · 0 评论 -
设定vituralbox ubuntu的swap memory
The memory setting you see is only used to configure the VM's RAM. However, the swap space definition is part of the disk image. This image is provided to you as part of theconfig.vm.boxdefinition i...原创 2020-04-12 23:50:18 · 361 阅读 · 0 评论 -
Differences between Shared and Static Libraries?
Differences between Shared and Static Libraries?Static LibrariesAdvantages:Speed All the code to execute the file is in one executable file, with little to virtually zero compatibility issuesD...转载 2019-10-31 05:15:51 · 215 阅读 · 0 评论 -
Unix shell和awk 变量交互
awk中使用shell的环境变量一:"'$var'"这种写法大家无需改变用'括起awk程序的习惯,是老外常用的写法.如:var="test"awk 'BEGIN{print "'$var'"}'这种写法其实际是双括号变为单括号的常量,传递给了awk.如果var中含空格,为了shell不把空格作为分格符,便应该如下使用:var="this is a test"awk原创 2012-02-15 17:30:39 · 1586 阅读 · 0 评论 -
Unix 处理当前目录下文件
#!/bin/bashfor file in $(ls)do echo "file:$i"donefor file in $(*)do echo "file: $i"done原创 2012-02-16 14:56:19 · 492 阅读 · 0 评论 -
Unix script 10 - variables II 输入变量
There are a set of variables which are set for you already, and most ofthese cannot have values assigned to them.These can contain useful information, which can be used by the scriptto know about th转载 2012-02-03 15:14:47 · 406 阅读 · 0 评论 -
Unix script 12 - extrnal programs 外部程序
External programs are often used within shell scripts; there are a fewbuiltin commands (echo,which, andtestare commonly builtin), but many useful commands are actually Unix utilities,such astr,gre转载 2012-02-03 17:03:43 · 364 阅读 · 0 评论 -
Unix script 5 - wildcards 星号
Wildcards are really nothing new if you have used Unix at all before.It is not necessarily obvious how they are useful in shell scripts though.This section is really just to get the old grey cells t转载 2012-02-01 16:41:20 · 636 阅读 · 0 评论 -
linux开机后首先加载的几个文件介绍
先来一段通用的解释:/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的转载 2012-05-19 14:04:39 · 1405 阅读 · 0 评论 -
sed一次性插入多行
[root@ ~]# sed "2 a\ asdsdasdasdadsasda\nsdasdasdsdasdasda " test#!/bin/bashtestIFS=$IFS asdsdasdasdadsasdasdasdasdsdasdasda aa=#aa:bb:ccif `expr $aa : '^[#]' > /dev/null`then echo原创 2012-02-16 13:09:03 · 10395 阅读 · 0 评论 -
Unix awk 替换域
awk -F: 'BEGIN{OFS=":"}/Mike Harrington/{$1="xx xxxx";print}' urfile原创 2012-02-15 17:28:47 · 1046 阅读 · 0 评论 -
Unix script 8 - Test if else
Test is used by virtually every shell script written. It may not seem that way, becausetest is not often called directly.test is more frequentlycalled as[. [ is a symbolic link totest, just to make转载 2012-02-01 18:35:39 · 690 阅读 · 0 评论 -
Unix scrip 11 - variables III 大括号
As we mentioned in Variables - Part I, curly brackets around a variable avoid confusion:foo=sunecho $fooshine # $fooshine is undefinedecho ${foo}shine # displays the word "sunshine"That's转载 2012-02-03 15:23:26 · 508 阅读 · 0 评论 -
Unix 处理多个输入文件
t.sh a.hv b.hv ...for variabledo commandcommand...donefor variable in "$@"docommand command...done原创 2012-02-16 14:53:28 · 456 阅读 · 0 评论 -
unix 双引号与单引号在awk sed使用
" "(雙引號) 與 ' '(單引號)差在哪? 還是回到我們的 command line 來吧...經過前面兩章的學習,應該很清楚當你在 shell prompt 後面敲打鍵盤、直到按下 Enter 的時候,你輸入的文字就是 command line 了,然後 shell 才會以行程的方式執行你所交給它的命令。但是,你又可知道:你在 command line 輸入的每一個文字,转载 2012-02-14 18:24:12 · 2108 阅读 · 0 评论 -
sed 编辑后保存到源文件
我想用sed删除同时符合$KEYWORD1和$KEYWORD2条件的行,删除后保存至原来文件。sed "/$KEYWORD1.*.$KEYWORD2/d" $TAIZHANG上面那条命令已经能够剔除同时符合$KEYWORD1和$KEYWORD2的行,但是没法保存至原文件。用:sed "/$KEYWORD1.*.$KEYWORD2/d" $TAIZHANG > $TAIZH转载 2012-02-14 21:03:36 · 6388 阅读 · 0 评论 -
unix tar gzip压缩解压
tar命令tar 文件是几个文件和(或)目录在一个文件中的集合。这是创建备份和归档的佳径。tar 使用的选项有:-c 创建一个新归档。-f 当与 -c 选项一起使用时,创建的 tar 文件使用该选项指定的文件名;当与"-x"选项一起使用时,则解除该选项指定的归档。-t 显示包括在 tar 文件中的文件列表。-v 显示文件的归档进度。-x 从归档中抽取转载 2012-02-13 17:39:20 · 5547 阅读 · 0 评论 -
uname命令linux
uname命令的功能是显示电脑及操作系统信息。 uname --help 可查看命令参数使用方法。 uname -a 相当于使用以下所有参数。 uname -s 显示内核名字。 uname -n 显示网络节点主机名。 uname -r 显示内核发行版本号。 uname -v 显示内核版本。 uname -m 显示机器硬件名称。转载 2012-05-21 13:16:44 · 599 阅读 · 0 评论 -
Unix 命令链接 ln
Linux/Unix 档案系统中,有所谓的连结(link),我们可以将其视为档案的别名,而连结又可分为两种 : 硬连结(hard link)与软连结(symbolic link),硬连结的意思是一个档案可以有多个名称,而软连结的方式则是产生一个特殊的档案,该档案的内容是指向另一个档案的位置。硬连结是存在同一个档案系统中,而软连结却可以跨越不同的档案系统。ln source dist 是产生一个转载 2012-05-22 17:03:32 · 1370 阅读 · 0 评论 -
更改默认shell Unix
如果默认是csh,想改成bash,那么可以编辑用户目录下的.cshrc文件,在最后加一行/usr/bin/bash这样启动csh后就会自动执行bash。另一个办法是使用chsh,推荐使用这个办法,直接在shell窗口中输入chsh,然后输入登陆密码,这时系统会显示旧的shellOld shell: /bin/cshNew shell: 此时输入/bin/转载 2012-05-22 17:12:39 · 1167 阅读 · 0 评论 -
How do I move files based on size Unix?
Move all files smaller than 500kilobytes to destinationfind . -type f -size -100k -exec mv '{}' ../ \;Move all files larger than 500kilobytes to destinationfind . -type f -size +500k -exec mv ...原创 2019-09-27 02:03:07 · 181 阅读 · 0 评论 -
On Linux, how to tell how many cores of the machine are active?
You can use top to list the utilization of each core. Press 1 if necessary to split the CPU row into a separate row for each core.You can also add a column that shows the last-used core for each转载 2017-09-14 20:02:02 · 294 阅读 · 0 评论 -
Understanding top command in unix
All this information is available in the top man page which you can read by running man top. Here is a breakdown:The CPU(s) row shows:CPU state percentages based on the interval转载 2017-09-14 20:01:24 · 343 阅读 · 0 评论 -
Unix enviorment
down voteJust execute env in a terminal.Example output:$ envTERM=xtermSHELL=/bin/bashUSER=joksnetUSERNAME=joksnetDESKTOP_SESSION=gnomePATH=/usr/local/sbin:/usr/local/bin:/usr转载 2017-09-14 19:59:42 · 295 阅读 · 0 评论 -
Checking standard output of PBS jobs in real time
Currently, PBS is configured so that the standard output/error of their jobs are redirected to temporary files and copied back to the final destination after their jobs finish. Hence, users can only a转载 2017-05-24 00:02:46 · 1758 阅读 · 0 评论 -
cat -n
You can use the cat command concatenate files and show on the screen under Linux or Unix like operating systems. The cat command also number all output lines starting with number one with the fo转载 2017-01-20 17:51:51 · 1958 阅读 · 0 评论 -
How do I find out what version of Linux I'm running?
The kernel is universally detected with 'uname':$ uname -or2.6.18-128.el5 GNU/LinuxThere really isn't a cross-distribution way to determine what distribution and version you're on. There are a转载 2014-02-15 00:33:23 · 641 阅读 · 0 评论 -
puduino 命令行连接无线网
1、查看自己的无线网卡是否生效查看挂载的USB设备(最好执行startx后在LXTerminal里执行,有些命令有好几屏可以用鼠标翻屏)一. sudo lsusb我的RPI显示如下:1pi@raspberrypi:/$sudo lsusb2 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root转载 2013-09-03 20:30:18 · 1610 阅读 · 0 评论 -
查看linux Unix系统32位或64位
1.#uname -a如果有x86_64就是64位的,没有就是32位的这是64位的 # uname -a Linux WORKS 2.6.9-11.ELsmp #1 SMP Fri May 20 18:25:30 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux 这是32位的 #uname -a Linux backup 2.6.9-67.ELsmp转载 2013-07-31 16:56:42 · 1422 阅读 · 0 评论 -
Ubuntu下安装搜狗输入法
http://code.google.com/p/ibus-sogoupycc/wiki/Install我的是ubuntu 10.04LTS 从安装包装不上,所以只好选择源代码从源代码安装1.先构造安装编译环境 确保有cmake ,可以apt-get install cmakeliblua5.1-0-dev, liblua5.1-socket2, libsqlite3-原创 2011-02-13 21:00:00 · 1928 阅读 · 0 评论 -
./configure : /bin/sh^M : bad interpreter
I've been trying to install lpng142 on my fed 12 system. Seems like a problem to me. I get this error[root@localhost lpng142]# ./configurebash: ./configure: /bin/sh^M: bad interpreter: No such file转载 2012-11-12 10:31:11 · 895 阅读 · 0 评论 -
apache 查看连接状态
ps -ef|grep httpd|wc -lnetstat -nat|grep -i "80" |wc -lnetstat -na|grep ESTABLISHED|wc -lnetstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'netstat -na|grep ESTABLISHED|awk '{转载 2012-08-10 10:16:11 · 640 阅读 · 0 评论 -
安装apache on Unix
./configure --prefix=/home/julio/apache/httpd-2.4.2/srclib/aprmakemake install./configure --prefix=/home/julio/apache/httpd-2.4.2/srclib/apr-util/ --with-apr=/home/julio/apache/httpd-2.4.2/s原创 2012-08-07 19:48:53 · 1142 阅读 · 0 评论 -
查看本机DNS linux
cat /etc/resolv.conf转载 2012-08-08 19:59:19 · 761 阅读 · 0 评论 -
Unix script - 14 hints and tips
Unix is full of text manipulating utilities, some of the more powerfulof which we will now discuss in this section of this tutorial. The significance of this, is that virtually everything under Unix转载 2012-02-04 16:35:07 · 681 阅读 · 0 评论 -
Unix tr 替换删除字符
1、关于tr 通过使用 tr,您可以非常容易地实现 sed 的许多最基本功能。您可以将 tr 看作为 sed 的(极其)简化的变体:它可以用一个字符来替换另一个字符,或者可以完全除去一些字符。您也可以用它来除去重复字符。这就是所有 tr 所能够做的。 tr用来从标准输入中通过替换或删除操作进行字符转换。tr主要用于删除文件中控制字符或进行字符转换。使用tr时要转换两个字转载 2012-02-04 16:26:11 · 4857 阅读 · 1 评论 -
Unix head tail 显示头尾几行
head命令● 默认 选项不指定任何选项的时候,比如执行head f.java,则显示f.java文件的全部内容。● -n 选项显示指定文件的前n行,n为一个整数。■ tail命令● 默认 选项不指定任何选项的时候,比如执行tail f.java,则显示f.java文件的全部内容。● -n 选项显示指定文件的后n行,n为一个整数。--------------转载 2012-02-04 16:58:34 · 3889 阅读 · 0 评论 -
shell script 单引号和双引号
command line 的每一個 charactor ,分為如下兩種:* literal:也就是普通純文字,對 shell 來說沒特殊功能。* meta:對 shell 來說,具有特定功能的特殊保留字元。Literal 沒甚麼好談的,凡舉 abcd、123456 這些"文字"都是 literal ... (easy?)但 meta 卻常使我們困惑..... (confus转载 2012-02-01 16:28:41 · 718 阅读 · 0 评论