unix

查看Unix系统是32位还是64位

安稳与你 提交于 2020-02-09 02:31:42
#getconf查看OS位数 以下经过测试了 HP: getconf KERNEL_BITS Linux: getconf LONG_BIT AIX: getconf KERNEL_BITMODE #AIX上getconf命令可以获取系统的基本配置信息,比如操作系统位数,内存大小,磁盘大小等. 例如: 确定磁盘 hdisk0 大小,若是 root 用户,则输入: getconf DISK_SIZE /dev/hdisk0 确定实际内存大小:getconf REAL_MEMORY 确定内核是32位或64位: getconf KERNEL_BITMODE 确定机器硬件是32位或64位:getconf HARDWARE_BITMODE 举例: root@aixsvr:/#getconf DISK_SIZE /dev/hdisk0 34732 root@aixsvr:/#getconf REAL_MEMORY 2097152 root@aixsvr:/#getconf KERNEL_BITMODE 64 root@aixsvr:/#getconf HARDWARE_BITMODE 64 root@aixsvr:/#bootinfo -y #显示AIX系统内核是32位还是64位 64 #AIX和Linux都支持getconf -a查看所有系统配置,HP不支持; 来源: https://www

why can't I `mv` a directory without extra write permissions

寵の児 提交于 2020-02-07 03:37:11
问题 My understanding of permissions has been broken today. evaben@evaben /t/test> ll total 16K drwxr-xr-x 4 evaben evaben 4.0K Mar 13 12:44 ./ drwxrwxrwt 19 root root 4.0K Mar 13 12:43 ../ drwxr-xr-x 2 evaben evaben 4.0K Mar 13 12:44 mine/ drwxr-xr-x 2 root root 4.0K Mar 13 12:44 theirs/ I own the CWD, and mine , and have write permission on both. evaben@evaben /t/test> mv mine theirs/ mv: cannot move 'mine' to 'theirs/mine': Permission denied Of course I cannot move my directory into theirs; I

UNIX系统 ---- 文件I/O

大憨熊 提交于 2020-02-07 02:45:31
一、文件描述符 对于内核而言,所有打开文件都由文件描述符引用。文件描述符是一个非负整数。当打开一个现存文件或创建一个新文件时,内核向进程返回一个文件描述符。当读、写一个文件时,用open或creat返回的文件描述符标识该文件,将其作为参数传送给read或write。 二、open函数 调用open函数可以打开或创建一个文件。 int open ( const char * pathname , int oflag , . . . , /*mode_t mode8/ ); pathname是要打开或创建的文件的名字。 oflag参数可用来说明此函数的多个选择项。 O_RDONLY 只读打开。 O_WRONLY 只写打开。 O_RDWR 读、写打开。 O_APPEND 每次写时都加到文件的尾端。 O_CREAT 若此文件不存在则创建它。 O_EXCL 如果同时指定了O_CREAT,而文件已经存在,则出错。 O_TRUNC 如果此文件存在,而且为只读或只写成功打开,则将其长度截短为 0。 O_NOCTTY 如果pathname指的是终端设备,则不将此设备分配作为此进程的控制终端。 O_NONBLOCK 如果pathname指的是一个FIFO、一个块特殊文件或一个字符特殊文件,则此选择项为此文件的本次打开操作和后续的I/O操作设置非阻塞方式。 O_SYNC 使每次write都等到物理I

Cracking Digital VLSI Verification Interview 第三章

大憨熊 提交于 2020-02-05 21:49:51
目录 Programming Basics Basic Programming Concepts Object Oriented Programming Concepts UNIX/Linux Programming in C/C++ Programming in PERL Programming Basics Basic Programming Concepts [68] 在任何一种编程语言中,静态(static)变量和自动(automatic)变量,局部(local)变量和全局(global)变量之间有什么区别? 区分这些名词需要两个概念,作用域(scope)和存储持续时间(storage duration),前者定义了在何处可以访问变量,后者定义了在何时可以访问变量。 按照变量的作用域可以区分局部(local)和全局(global)变量。局部变量的作用范围有限,尽在声明它们的代码块中可见。而全局变量在声明后在程序的任何位置都可见。 存储持续时间可以区分自动(automatic)变量和静态(static)变量。静态变量的生命周其一直持续到程序结束,因此可以始终访问。自动变量具有有限的生命周期,只能持续到程序离开定义的块或者作用域为止。 例如:在以下的systemverilog代码中,global_int被声明为类成员,并且在整个类中具有全局作用域,而当取消引用该类的对象时

OSX terminal weird prefix

筅森魡賤 提交于 2020-02-05 08:45:29
问题 I noticed that I have some weird prefix in my bash terminal - unknown-MACADDRESS. I think in all unix terminals it is suppose to be host name and login. I've tried go to sharing and change my host name in there, but unknown- stays in terminal. Not sure where problem is, do you know how to change it? Thanks a lot for any help! 回答1: Use the hostname command $ sudo hostname dan 回答2: For me this: scutil --set HostName yourname changed the name and it works even after a restart. 来源: https:/

Shell Script : read the output to run the next command

点点圈 提交于 2020-02-05 08:17:09
问题 I am trying to run this but still not getting the output. Don't know were I am wrong. First the script should login to the server 2nd command is " netstat -tulpun | grep -i port (port & server list is in the same file) 3rd It may get 3 to 4 output here but I need only 25 PID output not the others #!/bin/bash while read -r -u10 server port line do echo ========== server: "$server" port: "$port" ========== ssh $line "netstat -tulpunt | grep -E \"\b$port\b\"" | awk '{print $7}' | grep '/' | awk

Why is Unix/Terminal faster than R?

老子叫甜甜 提交于 2020-02-05 07:01:07
问题 I'm new to Unix, however, I have recently realized that very simple Unix commands can do very simple things to large data set very very quickly. My question is why are these Unix commands so fast relative to R? Let's begin by assuming that the data is big, but not larger than the amount of RAM on your computer. Computationally, I understand that Unix commands are likely faster than their R counterparts. However, I can't imagine that this would explain the entire time difference. After all

Why is Unix/Terminal faster than R?

南楼画角 提交于 2020-02-05 07:01:03
问题 I'm new to Unix, however, I have recently realized that very simple Unix commands can do very simple things to large data set very very quickly. My question is why are these Unix commands so fast relative to R? Let's begin by assuming that the data is big, but not larger than the amount of RAM on your computer. Computationally, I understand that Unix commands are likely faster than their R counterparts. However, I can't imagine that this would explain the entire time difference. After all

BASH scripting for username/password constructs

我的未来我决定 提交于 2020-02-05 01:53:26
问题 I want to write a simple bash script using ncat to open a connection to a ISP and its port. The first command would be: nc address port Upon doing this, I am prompted first to provide a username. I must hit ENTER, and then I will be prompted to provide a password and then I must hit ENTER again. After this, I want to open a Terminal process window. Can anyone point me to sufficient resources for this type of scripting? I know the username and password already, but I'm not too sure how to work

How can I get R to plot something in Unix terminal

人走茶凉 提交于 2020-02-04 04:49:43
问题 I'm running R from Unix and would like to see all output without any pop-ups. So, for example, if in unix I run R -f test.r Where test.r is value = pnorm(rnorm(10000)) hist(value,breaks=10) I would like the output to include a histogram drawn in the terminal. Is this possible? I'm assuming I need some kind of Unix plotting package. 回答1: There is txtplot package. Here is an example from the manual on how to output a histogram: ## text based barchart x <- factor(c("orange", "orange", "red",