Category: ubuntu
-
Postgres – Executing SQL-Statement in several remote machines sequentially
echo ‘psql -a -d mydatabase -p 5432 -c “\d mytable;”‘| ssh myuser@myserverhost.net ‘sudo su – postgres -c “bash -x — ” ‘ echo ‘psql -a -d mydatabase -p 5432 -c select id from mytable where id = 393050;”‘| ssh myuser@myserverhost.net ‘sudo su – postgres -c “bash -x — ” ‘
-
Unix – vi mini cheat sheet
String Replacement :1,$/s/String1/String2/g Yanking y9y (with : ) -> kopies current and next 9 lines p -> pastes the kopied mentioned lines Yanking using vi – adding files together – copy 30000 lines 30000 yy yy30000 The Yank Command yy make a copy of the current line and place it in the General Purpose Buffer…
-
Unix – Check and Monitor Open Ports and established Connections
lsof -i lsof -i | less # firefox example lsof -i | grep firefox check every second while [ “1” ] ; do clear; lsof -i; sleep 1; done; # firefox example while [ “1” ] ; do clear; lsof -i | grep firefox; sleep 1; done; netstat |grep localhost while [ “1” ] ;…
-
Unix – disk and file size monitoring with du, df and stat
du – file space usage GB sized files and directories du -xh DIRPATH |egrep “^[0-9\.]+[GT]\s” # Examples du -xh ~/ |egrep “^[0-9\.]+[GT]\s” sudo du -xh / |egrep “^[0-9\.]+[GT]\s” Size Of Directory and Disk Space du -s .archived/ du –sk # k: output in in KB # x=> expands, only on the local file system –…
-
Unix – tar – package and compress files and directory
Create an archive To create an archive of the entire test directory, issue the following command: tar cvf my_arch.tar /home/oracle/alex/test Compress the Files or Directory with gzip tar cvf – filenames | gzip > file.tar.gz Compress the Files or Directory with bzip2 tar cvf – directorypath | bzip2 > file.tar.bz2 If you want to include…
-
Ubuntu Upgrading from 12.04(Precise Pangolin) to 12.10(Quantal Quetzal)
Here’s how I upgraded to Ubuntu 12.10 from 12.04 sudo do-release-upgrade -d References http://www.unixmen.com/how-to-upgrade-from-uabuntu-1004-1010-1104-to-ubuntu-1110-oneiric-ocelot-desktop-a-server/