Ubuntu Related

******************************************************************************************************************************************

If you want to count the number of lines in a specific file, Ubuntu lets you do that easily:

wc -l filename

******************************************************************************************************************************************

If you have a large text file and only want to read the last few lines, use the tail command (source):

tail [ +-[number][lbcr] ] [file]

******************************************************************************************************************************************

To find out the TCL/TK version on your Ubuntu machine (source):

echo 'puts $tcl_version;exit 0' | tclsh

******************************************************************************************************************************************

For managing font embedding within a PDF file, one can do the following:

gs -q -dNOPAUSE -dBATCH -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf

Obviously, you have to have ghostscript installed on your Ubuntu machine. I needed this for making sure my PDF was compliant with the IEEE PDF eXpress. I got this from here.

The command "pdffont file.pdf" allows one to see the fonts used within a PDF file, and the emb column explains which of these are embedded and which are not - source.

*********************************************************************************************************************************************

Excellent piece of help for sorting numbers from a file within Unix: here. Will also help out for the AWK scripts as well.

How to apply a patch and how to create a patch using the diff command.

Installing Google Chrome on Ubuntu 12 etc

*********************************************************************************************************************************************

If your Synaptic touchpad on your laptop stops working whilst you use Ubuntu 12.04, these commands might solve the problem:

sudo modprobe -r psmouse && sudo modprobe psmouse proto=imps (source)

*********************************************************************************************************************************************

*********************************************************************************************************************************************

*********************************************************************************************************************************************

Github:

When you download and install git on your Ubuntu machine, you might blindly follow the guidance to try something in the git config file, and therefore ending up with the following error when trying to start up with git:

"fatal: bad config file line 1 in /home/so_and_so/.gitconfig"

The best thing to do is remove the text you have in the .gitconfig file, and write something like this:

[user]

name = So And So

email = so_and_so@myUniv.edu

and then save this file, and do the user-name and email configuration when asked (i.e., while cloning a repository) for on the command prompt. - source

*********************************************************************************************************************************************

For doing the push for the first time, try this:

git push origin master

Afterwards, we would only need to do "git push" (source)

*********************************************************************************************************************************************

If you want to delete a folder from your repository:

rm -rf folder
git add .
git commit -a -m "removed folder"
git push origin master

*********************************************************************************************************************************************

*********************************************************************************************************************************************

If you want to empty trash from command line:

rm -rf ~/.local/share/Trash/*

*********************************************************************************************************************************************

If you want to find out the status of a process with ID id:

ps -p id

*********************************************************************************************************************************************

Running a remote process from SSH in background (source):

nohup myprogram > foo.out 2> foo.err < /dev/null &

*********************************************************************************************************************************************

Gnuplot:

If you want to be able to produce EPS or PNG files as output from your Gnuplot script, you can look at this website for help.

*********************************************************************************************************************************************

*********************************************************************************************************************************************

Grep:

Grep is an excellent way to find strings within files on your Ubuntu machine. If you want to find for a string recursively within the current directory, write this:

grep -r "texthere" .

*********************************************************************************************************************************************