Category Archives: unix

unix – run/send process in the background

Below are a few ways of achieving that Option1: nohup With nohup (no-hangup): nohup <command-line> > <to_file.out> & (use >> to append) Option 2: pause/restart as background process Issue is when you need to provide some user inputs. In that case, proceed as follows: Run CLI as per normal and provide required user input Once no more input is required, hit ctrl+Z to stop/pause the job Run following command to identify your job id (different from pid): jobs Note: in above screenshot my job_id would be “1” Disown the process: disown -h %<job_id> Note: “%” is required Resume process: bg […]

plymouthd crashed with sigsegv in script_obj_deref_direct() [SOLVED]

I had this crash report upon booting my up-to-date ubuntu. In order to remove this: edit /etc/default/grub: sudo vi /etc/default/grub comment out line: #GRUB_CMDLINE_LINUX_DEFAULT=”splash plymouth:debug” add new line: GRUB_CMDLINE_LINUX_DEFAULT=”splash plymouth:debug” reboot grub: sudo update-grub That’s it. It is supposed to activate debugging and log info into /var/log/plymouth-debug.log. Which it does, but it also got rid of the error. sources

unix – list content of tar file and extract specific file

To list content of tar.gz file: tar -tvf my-data.tar.gz ‘<looked-for-file-or-path-name>’ To extract specific cotnent from tar.gz file: tar -xvpBf my-data.tar.gz ‘<path-name>’ sources

Feed unix pipe into ls / feed ls with pipe

To feed “ls” instruction with pipe, simply use xargs as per below: find . -type f -name mypattern* | xargs ls -l sources

unix – split large text file into smaller one

run: split -a 5 -d -l 10000 my_file.txt my_file_ usage: split -a 5 -d -l <nb_lines_per_file> <file_to_split> <split_prefix> d = numeric numbering (instead of alphabetical) l = number of lines per split files a = number of characters used for numbering (increase it in case of exhaustion) sources

unix – compare folder tree and identify files which are different

Very easy: sources diff -arq folder1 folder2

unix – use ps and grep to kill processes [solved]

To kill specific processes in one go, use below syntax: kill $(ps aux | grep ‘[m]y_specific_process’ | awk ‘{print $2}’) Note: using ‘[]’ is a hack to prevent grep process from being included in returned output sources

run process in background and keep it running after ssh exit [done]

To do so, simply use “disown <pid>” command. Proceed as follows: ssh into server run command and put it in background: & note the id of the command being returned (or run either “jobs -l” or “ps aux | grep myprocess” to find it back) run command: disown <pid> exit ssh ssh into server again run “ps aux | grep <pid>” should return content Alternatively use “nohup”: simply prefix your command with “nohup” example: nohup & sources

unix – file cannot be deleted or modified, even by root user [solved]

I had a file that could not be edited / removed / moved, even by root user. Reason for it is that this file was declared immutable. To solve this, run: sudo chattr -i <path/to/file> Now file can be edited/removed/moved. sources  

ubuntu with gnome 3 – change login screen logo [solved]

To change login screen logo on ubuntu with gnome 3, proceed as follows: sudo apt-get install dconf-editor open dconf-editor as root: sudo dconf-editor navigate to org > gnome > login-screen update value of “logo” variable to the path of logo file to use restart GDM And voilà! sources