Category Archives: unix

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  

ubuntu – install all google fonts and use them in gimp

To install all google fonts in gimp on ubuntu, proceed as follows: download fonts from create a folder “.fonts” in your home directory: mkdir ~/.fonts unzip content of downloaded file into newly created .fonts folder: cd ~/.fonts; unzip ~/Downloads/ regenerate font cache: sudo fc-cache -fv restart gimp That’s it. All fonts should be avaialable sources

gnome – change default screenshot program

Default screenshot program is easy to use and does the job. If you want to go slightly forward, such as selecting screenshot area, editing screenshot and so on, you should give a go to “shutter” as an alternative. steps install shutter: sudo apt-get install shutter set up shutter as default application go to keyboard shortcuts under tab “Customs Shortcuts” create a new shortcut running “shutter -s”, as per below assign the print-screen button as activation button for this shortcut, as per below done! sources