I have a list of files eg. How do I use rename to be like this: I am new to this and having trouble understanding the examples online. I want to do something like the following where the ? is a variable character: Answer ? mean “any character”. So, your page-1.htm will be rename because it’s…
Tag: linux
Storing and accessing an array of struct from shared memory
I am writing a program on a hotel reservation system and have declared a struct Room as follows: I use a variable read from an input file to create an array of n structs which is all the rooms in the hotel. I then create the shared memory space and attach it, but when I try to access it after,
How to reproduce the accept error in Linux
I’m learning Unix Network Programming Volume 1, I want to reproduce the accept error for RST in Linux. server: call socket(), bind(), listen(), and sleep(10) client: call socket(), connect(), setsockopt() of LINGER, close() and return server: call accept() I think that the 3rd steps will get an error li…
Linux SHELL script, read each row for different number of columns
I have file and for example values in it: I need to read values using the shell script from it but number of columns in each row is different!!! I know that if for example I want to read second column I will do it like this (for row number as input parameter) But as I mentioned number of columns
What kind of owner and group for these below list of files?
what is the owner and group of this below file? It has 0 and 0 for owner and group. I found those permissions after connecting to a remote server for which we does not have write permissions. How to replicate the same permisions in my development machine? Answer 0:0 is almost always root:root owner and group.…
How to pass “-L” to an awk script?
I am trying to write an awk script that accepts -L as an argument. As an example to show you what I want, here is a simple awk script called awktest: If I run this from shell: I get as output: Which is what I expect. It seems to work for anything I put in except -L. If I run:
Segmentation fault when maping /dev/mem
I’m trying to mmap a memory from my FPGA on a linux running on my Zedboard SoC. I can read the contents correctly using devmem on the command line, but when trying to read it through C I get a segmentation fault. The barebones code shown below throws the segmentation fault when trying to print the conte…
Return custom process command in Ubuntu
I want to launch the following script in bash and the “ps -A | grep php” command returns something if the script is running. Is there any way to customize this “php” command with another name? I want to write and “ps -A | grep php” should return nothing, but “ps -A | …
Obtaining IP from command ‘host’ executed inside python
I have this function to show me the 1st ip of a domain: But this only shows me the first ip. I’d like to show only the ip’s. The marker is for not having “has address” as shown below (imagine I input “reddit.com”: I want to show only the ips, not reddit.com has addressnor o…
My newly compiled kernel loses Networking in qemu
I compiled a kernel from source : make defconfig make kvmconfig make -j 4 After this , i use the resulting bzImage for my qemu command: qemu-system-x86_64 -hda debian.img -kernel bzImage -append “root=/dev/sda console=ttyS0” -nographic -m 4096 -smp 2 –enable-kvm -net user,hostfwd=tcp::10021-…