I have files which are very large (> 5G), and I want to remove some lines by the line numbers without moving (copy and paste) files. I know this command works for a small size file. (my sed command do not recognize -i option) This command takes relatively long time because of the size. I just need to remov…
Tag: linux
Change ownership and permission without terminal – Python
I have a gui made in glade and am stuck on one thing. I have a button that changes the ownership and permissions; it works fine except for folders and files owned by root. Is there anyway of invoking root privilages to run this command without having to input the root password in terminal? i.e. either predefi…
using nohup -> output to file and console
iam using nohup in my project. Is there a possibility get the Output of the program to the console and to the file at the same time while using nohup? With “tee”i had no sucess: thanks for help Answer Try this to run and log the output in file. If you want to run it in background:
Issues with compiling caffe with python, undefined reference to `std::__cxx11::….’
I used to compile successfully caffe with WITH_PYTHON_LAYER:=1 on Ubuntu 14.04. Then I switched to Ubuntu 16.04, using the same settings but different built-in software such as g++ 5.4 for 16.04 instead of g++ 4.8 for 14.04, I failed to compile caffe with python. Would you please give me some advice on this i…
qt run shell commands via qprocess
I am developing a small QT application to interact with the terminal, to send commands to the terminal and to read back information printed out. Example: get output of all processes using ps -aux PROBLEM I am able to write information out to the terminal but I dont think it is in the system scope, actual exam…
Linux kernel: get information of page cache distribution over NUMA nodes
When Linux kernel runs on NUMA, each NUMA node has partially separate memory management. There is echo ‘?’ > /proc/sysrq-trigger function “Will dump current memory info to your console.” of SysRq (implemented as sysrq_handle_showmem and show_mem) to get basic memory statistics for e…
How To Delete A File Every X Times A Script Is Run – Manage A Log File From Inside A Script?
I would normally just schedule this as a cron job or script, however, I would like to delete a log file (it’s constantly appended to every time a script runs) only after 50 times. Needed Inside The Script: The thing is, since the script does not run consistently, it has be to be implemented within the s…
How do I find which user installed a package in linux?
Is there a way to find out which user installed a package in linux? Answer Usually packets are installed by the superuser (root) account. In case users use sudo to install them, you can check ~/.bash_history for each user tu inspect who issued the $ sudo apt-get install PACKAGE (in case you’re using apt…
How to run a command in bash which captures the output and waits until the command has finished?
I am using the following in a bash script: command >> /var/log/somelog.log 2>&1& The reason I’m doing this is because I want to capture all output in /var/log/somelog.log. This works fine. However it does not wait until the command has finished. So that brings me to the question, how ca…
How to implement a process overseeing another process?
Currently at my workplace I have a script named “batch launcher” (written in bash), which is supposed to oversee the execution of batches, logging their output and processing the return code of the batch. This is currently done via env call within this “batch launcher”: Several days ag…