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 https://askubuntu.com/questions/864242/plymouth-error-logging https://wiki.ubuntu.com/Plymouth#Debugging https://bugs.launchpad.net/ubuntu/+source/ubuntu-gnome-default-settings/+bug/1536771

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 https://www.cyberciti.biz/faq/list-the-contents-of-a-tar-or-targz-file/

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 http://stackoverflow.com/questions/18210956/unix-pipe-into-ls

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 https://kb.iu.edu/d/afar

unix – compare folder tree and identify files which are different

Very easy: sources diff -arq folder1 folder2 http://stackoverflow.com/questions/1644593/unix-compare-two-folders-which-has-many-files-inside-contents

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 http://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex

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: myprocess.sh & 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 myprocess.sh & sources http://www.cyberciti.biz/faq/unix-linux-disown-command-examples-usage-syntax/ http://stackoverflow.com/questions/5164985/how-can-i-use-nohup-to-run-process-as-a-background-process-in-linux http://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and http://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session

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 http://www.omgubuntu.co.uk/2016/03/fix-failed-to-fetch-google-chrome-apt-error-ubuntu  

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 http://ubuntuhandbook.org/index.php/2014/04/ubuntu-14-04-change-login-screen-background-remove-the-white-dots/ http://stackoverflow.com/questions/29189648/why-cant-i-change-the-gnome-login-screen-logo