Category Archives: unix

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 https://github.com/google/fonts/archive/master.zip create a folder “.fonts” in your home directory: mkdir ~/.fonts unzip content of downloaded file into newly created .fonts folder: cd ~/.fonts; unzip ~/Downloads/master.zip regenerate font cache: sudo fc-cache -fv restart gimp That’s it. All fonts should be avaialable sources https://github.com/google/fonts/ http://askubuntu.com/questions/3697/how-do-i-install-fonts https://wiki.ubuntu.com/Fonts https://www.google.com/fonts

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 http://askubuntu.com/questions/252717/how-to-make-shutter-as-the-default-screenshot-tool  

gnome 3 – default theme – header way too big [solved]

To reduce window header: create a file under vi ~/.config/gtk-3.0/gtk.css enter following css content (customize padding values and font sizes as required): .header-bar { padding-top: 1px; padding-bottom: 1px; font-size: 7px; } .header-bar .button { padding-top: 1px; padding-bottom: 1px; } .header-bar.default-decoration { padding-top: 1px; padding-bottom: 1px; border: none; background-image: linear-gradient(to bottom, shade(@theme_bg_color, 1.05), shade(@theme_bg_color, 0.99)); box-shadow: inset 0 1px shade(@theme_bg_color, 1.4); } .header-bar.default-decoration .button.titlebutton { padding-top: 1px; padding-bottom: 1px; } Witness the impact live by restarting gnome shell: alt+f2 then run “r” And voilà! To go further: run “gnome-tweak-tool” under section “fonts”, reduce various font sizes and play with “scaling factor” […]

sick of nautilus opening target folder when moving files, switching to nemo

To switch to nemo file-manager, proceed as follows: Install packages: sudo apt-get install nemo nemo-fileroller Activate nemo: sudo xdg-mime default nemo.desktop inode/directory application/x-gnome-saved-search sudo gsettings set org.gnome.desktop.background show-desktop-icons false sudo gsettings set org.nemo.desktop show-desktop-icons true Ensure nemo was activated properly: xdg-mime query default inode/directory nemo.desktop sources http://askubuntu.com/questions/481742/how-to-replace-nautilius-with-nemo-in-gnome-3

unix – find all files in folder with or without size

To find all files (without following symlinks): find -P . -type f To find all files along with their corresponding size in bytes: find -P . -type f -exec stat -c ‘%s      %n’ {} \; sources http://askubuntu.com/questions/460210/using-find-and-stat-to-display-filenames-and-statistics

Unix – find files modified on a specific date / between two dates

“find” command is our friend here, using “-newer” argument. This is a 2-step process: create reference file(s) with required date limit(s) run find command with reference to this/these file(s) find all files modified after 2015/12/15 6:51pm and 2 seconds touch -t 201512151851.02 /tmp/t find . -newer /tmp/t find all files modified between two dates touch -t <date1> /tmp/t1 touch -t <date2> /tmp/t2 find . -newer /tmp/t1 -and -not -newer /tmp/t2 sources http://stackoverflow.com/questions/158044/how-to-use-find-to-search-for-files-created-on-a-specific-date

create zip file from shell

pretty easy! open shell and run: zip <path_to_file_to_create>.zip <elements_to_add> Example: zip ../mycontent.zip *.xml

/bin/cp: cannot execute [Argument list too long] – [solved]

When executing simple command line statements such as rm, cp or ls on a folder containing large number of files, following error is thrown: cannot execute [Argument list too long] Workaround this issue is to use the “find” process along with “-exec” argument, as per below example on copy statement: find <src_path> -name “*.xml” -exec cp “{}” <destination_path> \; note: replace “cp” with “rm” or whichever command failing due to large number of entries. sources http://stackoverflow.com/questions/11289551/argument-list-too-long-error-for-rm-cp-mv-commands http://stackoverflow.com/questions/143171/how-can-i-use-xargs-to-copy-files-that-have-spaces-and-quotes-in-their-names

unix – count number of files inside a folder

Simply run following command line: ll *.xml | wc -l in above example, we are counting number of files ending with .xml => feel free to adapt this query

linux: search text in files matching specific name

Combination of “find” and “grep” as follows: find . -type f -name “*.xml” -exec grep -H “<needle>” {} \; notes: this example is searching for files in current folder (“.”) with name ending in “.xml” (“*.xml”) and looking having word “<needle>”, -H option will print names of files for which condition is matched sources http://stackoverflow.com/questions/21763904/linux-find-and-grep-command-together