Pokazywanie postów oznaczonych etykietą linux. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą linux. Pokaż wszystkie posty

poniedziałek, 11 czerwca 2018

linux hibernacja uswsusp

Narzędzia do wstrzymywania programów przestrzeni użytkownika Linuksa
 
Pakiet (znany również jako µswsusp, suspend-utils albo po prostu suspend)
zawiera programy do wstrzymywania działania oprogramowania przestrzeni
użytkownika dostępne w jądrach Linuksa od 2.6.17-rc1 i wyższych. Umożliwia
zapisywanie stanu systemu na dysku i wyłączenie zasilania. Po wznowieniu
systemu zostanie on przywrócony do stanu, w jakim został pozostawiony
(czasami nazywa się to hibernacją).

Zawiera on również program do wstrzymywania systemu do pamięci RAM po
zapisaniu stanu na dysku. W tym stanie system wciąż korzysta z zasilania,
ale jego wznowienie jest szybsze. Jeśli bateria wyczerpie się, system
wznawiany jest z dysku bez utraty danych.

Opcjonalną funkcjonalnością jest szyfrowanie migawki systemu.

Aby używać tego pakietu, konieczne jest jądro Linuksa w wersji 2.6.17-rc1
lub wyższej, skonfigurowane tak, aby mogło korzystać z initramfs.
Udostępnione są procedury obsługi zdarzeń (hooks) i skrypty do integracji z
narzędziami initramfs.

niedziela, 6 maja 2018

How to Use Wget to Archive a Blogspot Blog

I saw this post who autor saw other post to archive a blogspot blog using wget in linux

The Wget command is:


wget -nc -w 1 -r --random-wait -k -l 2 -p -np -E -H --referer=http://pakowaniadrewna.blogspot.com -e robots=off --domains=pakowaniadrewna.blogspot.com,blogger.com,nerds-central.com,blogspot.com http://pakowaniadrewna.blogspot.com

poniedziałek, 12 marca 2018

Easy Webserver

Looking for a relatively painless way to launch a web server with document root in current folder? This list will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000.


Python 2.x


$ python -m SimpleHTTPServer 8000

Python 3.x


$ python -m http.server 8000

Twisted (Python)


$ twistd -n web -p 8000 --path .
Or:

$ python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(8000, Site(File("."))); reactor.run()'
Depends on Twisted.

Ruby


$ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'
Credit: Barking Iguana

Ruby 1.9.2+


$ ruby -run -ehttpd . -p8000
Credit: nobu

adsf (Ruby)


$ gem install adsf   # install dependency
$ adsf -p 8000
Credit: twome
No directory listings.

Sinatra (Ruby)


$ gem install sinatra   # install dependency
$ ruby -rsinatra -e'set :public_folder, "."; set :port, 8000'
No directory listings.

Perl


$ cpan HTTP::Server::Brick   # install dependency
$ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>8000); $s->mount("/"=>{path=>"."}); $s->start'
Credit: Anonymous Monk


Plack (Perl)


$ cpan Plack   # install dependency
$ plackup -MPlack::App::Directory -e 'Plack::App::Directory->new(root=>".");' -p 8000
Credit: miyagawa

Mojolicious (Perl)


$ cpan Mojolicious::Lite   # install dependency
$ perl -MMojolicious::Lite -MCwd -e 'app->static->paths->[0]=getcwd; app->start' daemon -l http://*:8000
No directory listings.

http-server (Node.js)


$ npm install -g http-server   # install dependency
$ http-server -p 8000
Note: This server does funky things with relative paths. For example, if you have a file /tests/index.html, it will load index.html if you go to /test, but will treat relative paths as if they were coming from /.

node-static (Node.js)


$ npm install -g node-static   # install dependency
$ static -p 8000
No directory listings.

PHP (>= 5.4)


$ php -S 127.0.0.1:8000
Credit: /u/prawnsalad and MattLicense
No directory listings.

Erlang


$ erl -s inets -eval 'inets:start(httpd,[{server_name,"NAME"},{document_root, "."},{server_root, "."},{port, 8000},{mime_types,[{"html","text/html"},{"htm","text/html"},{"js","text/javascript"},{"css","text/css"},{"gif","image/gif"},{"jpg","image/jpeg"},{"jpeg","image/jpeg"},{"png","image/png"}]}]).'
Credit: nivertech (with the addition of some basic mime types)
No directory listings.

busybox httpd


$ busybox httpd -f -p 8000
Credit: lvm

webfs


$ webfsd -F -p 8000
Depends on webfs.

IIS Express


C:\> "C:\Program Files (x86)\IIS Express\iisexpress.exe" /path:C:\MyWeb /port:8000
Depends on IIS Express.
Credit: /u/fjantomen
No directory listings. /path must be an absolute path.

sobota, 3 lutego 2018

Read EXIF data from image

From the command line in Linux
#sudo apt-get install imagemagick
Install imagemagic and it`s tool identyfi. Go to terminal and type
identify -verbose /home/user/image/2000-01-01-0001.jpg
will print all data from that file
identify -verbose /home/user/image/2000-01-01-0001.jpg | grep "exif:"
will print all exif data from that file Using exiftool First install exif tools
#sudo apt-get install exiftool
then run in terminal
exiftool -a /home/user/image/2000-01-01-0001.jpg | grep "Image Width"
or man exiftool


More usefull exiftool

środa, 12 kwietnia 2017

E: Can not write log, openpty() failed (/dev/pts not mounted?)

W: Can not write log, openpty() failed (/dev/pts not mounted?)


sudo mount --bind /dev ~/chroot/chroot-amd64-ubuntu10.04/dev
sudo mount --bind /dev/pts ~/chroot/chroot-amd64-ubuntu10.04/dev/pts
sudo mount --bind /proc ~/chroot/chroot-amd64-ubuntu10.04/proc/
sudo mount --bind /sys ~/chroot/chroot-amd64-ubuntu10.04/sys
Source: https://docs.google.com/document/d/186YFzm3vKggFvvdzATU2X6PioqFNaQnyqLsOAaI-IYA/edit

niedziela, 9 kwietnia 2017

How to create a new normal user with sudo permission

How to create a new normal user with sudo permission?

 This procedure can be used in any Linux distro to add a normal user. That includes ubuntu, Linux mint, or even Centos

useradd -m username

# -m creates a home directory for the user.
# for more config option while adding user read
man useradd
## :)
Set password using passwd in order to login

passwd username


Add user to sudores so that we can use “sudo” to do administrative actions.

usermod -a -G sudo username


The option -a means to add and ‘-G sudo’ means to add the user to the sudo group. If you want to know more about the usermod command, issue man usermod command to know more about usermod

piątek, 7 kwietnia 2017

How to fix a locale setting warning from Perl?

When I run perl, I get the warning:

When I run apt, I get the warning:

When I run aptitude, I get the warning:


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

instead of installing the locale, You can also change the locale. On my Ubuntu box, this is done for one user by editing ~/.pam_environmentChange the variables were es_US.UTF-8 or similar to en_US.UTF-8. or similar requested – Janus Troelsen Jun 8 '14 at 12:34 &  f1vefour Feb 18 '15 at 13:12

Use:
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
It works for Debian. I don't know why - but locale-gen had not results.
(add) On Debian, local-gen only processes locales that are uncommented in /etc/local.gen. You may need to do echo en_US UTF-8 >> /etc/locale.gen first. – akhmed Nov 24 '15 at 2:45

Important! It's a temporary solution. It has to be run for each session.
#pseudoPermament I just put it into my .bashrc file. – Anirudh Ramanathan Jun 8 '14 at 16:08 
Polskie zasoby ustawiania locale:7

Konfiguracja Locales w Ubuntu


Spam atraction: 
$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=ru_RU.UTF-8
LC_TIME=ru_RU.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=ru_RU.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=ru_RU.UTF-8
LC_NAME=ru_RU.UTF-8
LC_ADDRESS=ru_RU.UTF-8
LC_TELEPHONE=ru_RU.UTF-8
LC_MEASUREMENT=ru_RU.UTF-8
LC_IDENTIFICATION=ru_RU.UTF-8
LC_ALL=

$ sudo su

# export LANGUAGE=en_US.UTF-8
# export LANG=en_US.UTF-8
# export LC_ALL=en_US.UTF-8

# locale-gen en_US.UTF-8
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.

# dpkg-reconfigure locales
Generating locales...
  en_AG.UTF-8... done
  en_AU.UTF-8... done
  en_BW.UTF-8... done
  en_CA.UTF-8... done
  en_DK.UTF-8... done
  en_GB.UTF-8... done
  en_HK.UTF-8... done
  en_IE.UTF-8... done
  en_IN.UTF-8... done
  en_NG.UTF-8... done
  en_NZ.UTF-8... done
  en_PH.UTF-8... done
  en_SG.UTF-8... done
  en_US.UTF-8... up-to-date
  en_ZA.UTF-8... done
  en_ZM.UTF-8... done
  en_ZW.UTF-8... done
Generation complete.

# exit

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
Like stack mee to so like Me to :) SOURCE: http://stackoverflow.com/questions/2499794/how-to-fix-a-locale-setting-warning-from-perl

root@host:~#locale-gen en_GB.UTF-8
root@host:~#localectl set-locale LANG=en_GB.UTF-8,LC_ALL=en_GB.UTF-8

poniedziałek, 12 września 2016

Error! Could not locate dkms . conf file. File: does not exist.

Konfigurowanie pakietu linux-image-3.16.0-4-amd64 (3.16.36-1+deb8u1) ...
/etc/kernel/postinst.d/dkms: Error! Could not locate dkms.conf file.
File: does not exist.
 This problem cause old version of virtualbox in /var/lib/dkms
remove virtualbox, clear dkms folder of old virtualbox folder than install virtualbox again
  sudo apt-get remove virtualbox  sudo rm -rf /var/lib/dkms/vboxhost  sudo apt-get install virtualbox
 Basically you should check the timestamps of any directories under /var/lib/dkms that start with either 'vbox' or 'virtual'. If they're fairly old (e.g. > 1 year) then there's a reasonable chance that they might be cruft left over from an old version of VirtualBox. Deciding whether to delete them or not is at your discretion.

sobota, 6 sierpnia 2016

Recovering Files from a Corrupt CD/DVD

sudo dd if=/dev/cdrom of=~/cdrom.iso status=progress
dd: błędna flaga stanu: „progress”
Napisz „dd --help” dla uzyskania informacji.
fuck
sudo dd if=/dev/cdrom of=~/cdrom.iso
dd: błąd czytania „/dev/cdrom”: Błąd wejścia/wyjścia
578816+0 przeczytanych recordów
578816+0 zapisanych recordów
skopiowane 296353792 bajty (296 MB), 36,4562 s, 8,1 MB/s 
now its well know its broken. 
Warning!! If you reverse the source and target, you can wipe out a lot of data. This feature has inspired the nickname "dd" Data Destroyer. Warning!! Caution should be observed when using dd to duplicate encrypted partitions.
sudo ddrescue -b 2048 -d -r 300 -v /dev/cdrom /iso.iso /ddrescure.log
without -e param, cause:
 GNU ddrescue 1.19
About to copy 3890 MBytes from /dev/cdrom to .
 Starting positions: infile = 0 B,  outfile = 0 B
    Copy block size:  32 sectors       Initial skip size: 32 sectors
Sector size: 2048 Bytes
Press Ctrl-C to interrupt
rescued:   439353 kB,  errsize:   1376 kB,  current rate:        0 B/s
   ipos:   450101 kB,   errors:      21,    average rate:     919 kB/s
   opos:   450101 kB, run time:    7.96 m,  successful read:       1 s ago
Copying non-tried blocks... Pass 1 (forwards)
Too many errors in input filei
In copy process, thinknk how leaning algorithm can fix errors in file. I copy windows from old cd-rom. MS have md5 sing somwhere. So positive results is know by md5 Teach alorithm to fill corupted blocks with learning algorithm. Oh, y English is so bad ;) so what. 

środa, 20 lipca 2016

bash-it

Bash-it is a collection of community Bash commands and scripts. (And a shameless ripoff of oh-my-zsh :smiley:) Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more. Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work. 


If you're using the Bourne Again Shell (Bash) on a regular basis and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you!
Stop polluting your ~/bin directory and your .bashrc file, fork/clone Bash-it and start hacking away.

INSTAL

piątek, 15 lipca 2016

Google Earth under Debian

To avoid unnecessary time loos witch downloading and ruining google earth under Debian
cd ~;sudo apt-get install googleearth-package libfreeimage3 
sudo apt get install  libcurl3:i386 libraw10:amd64 libidn11:i386 librtmp1:i386 libssh2-1:i386
 cd ~; make-googleearth-package
 -----------------------------
Success!
You can now install the package with e.g:
sudo dpkg -i googleearth_6.0.3.2197+1.2.0-1_amd64.deb

~$ sudo make-googleearth-package 
Refusing to run as root; use --force to override


 linux debian install Googleearth-package as it says


sudo apt-get install googleearth-package
sudo aptitude install  libfreeimage3 libcurl3:i386 libidn11:i386 librtmp1:i386 libssh2-1:i386  

Narzędzie do automatycznej budowy pakietu Google Earth do Debiana

Google Earth jest przeglądarką naszej planety w 3D, która umożliwia interaktywną nawigację po zdjęciach satelitarnych, mapach, i tak dalej.
Oprogramowanie Google Earth jest dostępne do GNU/Linuksa ze strony internetowej producenta, lecz jest to niewolne oprogramowanie, nie nadające się do dystrybucji. Nie integruje się dobrze z systemem Debian.
To narzędzie pozwala budować własny pakiet Google Earth do Debiana. Samo opakowanie jest Wolnym Oprogramowaniem, ale program Google Earth jest regulowany przez posiadacza praw autorskich (Google), więc mogą istnieć ograniczenia co do dysponowania ostatecznym pakietem (tj. redystrybucji, itp.). Googleearth-package po prostu pomaga w tworzeniu pakietu - użytkownik jest odpowiedzialny za rozsądne korzystanie z ostatecznego pakietu.
NAME
       make-googleearth-package - builds a googleearth Debian package
SYNOPSIS
       make-googleearth-package [options]
DESCRIPTION
       Creates a Debian package from the Google Earth GNU/Linux installer.  By default, will look for the installer in the current directory.  If  not found it will be downloaded automatically.
OPTIONS
       --fullname name Use name as full name in Maintainer field
       --email email Use email as email address in Maintainer field
       --file file Use file instead of GoogleEarthLinux.bin
       --download Always try to download a new version
       --cleanup Delete the installer after building successfully
       --quiet Suppress all intermediate build output
       --force Attempt to build an unsupported version
                                4 October 2014     make-googleearth-package(1)

Google Earth under Debiana

To avoid unnecessary time loos witch downloading and ruining google earth under Debian
cd ~;sudo apt-get install googleearth-package libfreeimage3 
sudo apt get install  libcurl3:i386 libraw10:amd64 libidn11:i386 librtmp1:i386 libssh2-1:i386
 cd ~; make-googleearth-package
 -----------------------------
Success!
You can now install the package with e.g:
sudo dpkg -i googleearth_6.0.3.2197+1.2.0-1_amd64.deb

~$ sudo make-googleearth-package 
Refusing to run as root; use --force to override


 linux debian install Googleearth-package as it says


sudo apt-get install googleearth-package
sudo aptitude install  libfreeimage3 libcurl3:i386 libidn11:i386 librtmp1:i386 libssh2-1:i386  

Narzędzie do automatycznej budowy pakietu Google Earth do Debiana

Google Earth jest przeglądarką naszej planety w 3D, która umożliwia interaktywną nawigację po zdjęciach satelitarnych, mapach, i tak dalej.
Oprogramowanie Google Earth jest dostępne do GNU/Linuksa ze strony internetowej producenta, lecz jest to niewolne oprogramowanie, nie nadające się do dystrybucji. Nie integruje się dobrze z systemem Debian.
To narzędzie pozwala budować własny pakiet Google Earth do Debiana. Samo opakowanie jest Wolnym Oprogramowaniem, ale program Google Earth jest regulowany przez posiadacza praw autorskich (Google), więc mogą istnieć ograniczenia co do dysponowania ostatecznym pakietem (tj. redystrybucji, itp.). Googleearth-package po prostu pomaga w tworzeniu pakietu - użytkownik jest odpowiedzialny za rozsądne korzystanie z ostatecznego pakietu.
NAME
       make-googleearth-package - builds a googleearth Debian package
SYNOPSIS
       make-googleearth-package [options]
DESCRIPTION
       Creates a Debian package from the Google Earth GNU/Linux installer.  By default, will look for the installer in the current directory.  If  not found it will be downloaded automatically.
OPTIONS
       --fullname name Use name as full name in Maintainer field
       --email email Use email as email address in Maintainer field
       --file file Use file instead of GoogleEarthLinux.bin
       --download Always try to download a new version
       --cleanup Delete the installer after building successfully
       --quiet Suppress all intermediate build output
       --force Attempt to build an unsupported version
                                4 October 2014     make-googleearth-package(1)

sobota, 11 czerwca 2016

Free business card in Linux

Darmowe projektowanie Wizytówki w systemie linux
I need to make few business cards and I'd like to try designing them myself. Say yes, Linux have solutions.
QtQR is based and relies on Qt Python and the python-qrtools QR Code encoder and decoder (from file or webcam) i will use iiiit to generate QRCODE like this



QtQR
sudo dpkg -i qtqr_1.2_all.deb
sudo dpkg -i python-qrtools_1.2_all.deb


gLabels Label Designer is a GNU/Linux program for creating labels and business cards. It is designed to work with various laser/ink-jet peel-off label and business card sheets that you’ll find at most office supply stores. gLabels is free software and is distributed under the terms of the GNU General Public License (GPL).
Just download gLabels and dpkg -i`t


Other Tool:
https://inkscape.org/ Inkscape is professional quality vector graphics software

Scribus Professional layout and publishing software supporting EPS and SVG import/export, and PDF support. [GNU GPL]


Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux
cat /etc/apt/sources.list

deb http://ftp.pl.debian.org/debian/ jessie main non-free contrib
deb-src http://ftp.pl.debian.org/debian/ jessie main non-free contrib

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

# jessie-updates, previously known as 'volatile'
deb http://ftp.pl.debian.org/debian/ jessie-updates main contrib non-free
deb-src http://ftp.pl.debian.org/debian/ jessie-updates main contrib non-free
deb http://repository.mein-neues-blog.de:9000/ /

deb http://http.debian.net/debian/ jessie-backports main

czwartek, 9 czerwca 2016

Download an entire website using wget

wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
Functions: wget Download an entire website using wget
-p parameter tells wget to include all files, including images.
-e robots=off you don't want wget to obey by the robots.txt file
-U mozilla as your browsers identity.
--random-wait to let wget chose a random number of seconds to wait, avoid get into black list.

Other useful wget parameters:
--limit-rate=20k limits the rate at which it downloads files.
-b continues wget after logging out.
-o $HOME/wget_log.txt logs the output
Other resourcess:
man wget
If U have wget U have man wget also (*correct Me if I wrong)

środa, 8 czerwca 2016

commandline fu

sudo !!

Run the last command as root
Useful when you forget to use sudo for a command. "!!" grabs the last run command.
mount | column -t

nice layout in currently mounted filesystems

środa, 4 maja 2016

Bleachbit

BleachBit frees disk space and maintains privacy. Cleans cache, Internet history, temporary files, logs, cookies, and broken shortcuts. Cleans Firefox, Google Chrome, Opera, Windows, Linux, and much more.
https://sourceforge.net/projects/bleachbit/
http://www.bleachbit.org/

Odzyskana przestrzeń dysku: 1,19GiB
Usunięte pliki: 919
Specjalne operacje: 2

sudo apt-get install bleachbit menu

wtorek, 3 maja 2016

VirtualBox - RAW image to VDI or VMDK & vice versa

virtualbox dd image to vdi

Zachciało się ratować _OEMBP
$ sudo dd if=/dev/sdb of=./sdb.dd
 Converting RAW dd image to vdi using VBoxManage


$ VBoxManage convertdd sdb.dd sdb.vdi --format VDI
For VMware
$ VBoxManage convertdd sdb.dd sdb.vmdk --format VMDK
VMware VMDK to VirtualBox VDI
$ VBoxManage clonehd sdb.vmdk sdb.vdi --format VDI
VirtualBox VDI to VMware VMDK
$ VBoxManage clonehd sdb.vdi sdb.vmdk --format VMDK
Convert back to RAW dd image
$ VBoxManage clonehd sdb.vdi sdb.vdi.raw --format RAW $ VBoxManage clonehd sdb.vmdk sdb.vmdk.raw --format RAW
Alternative solution (not tested by me [source]) to get back raw image after applying 
modifications is to use qemu-img command from qemu package:

$ qemu-img convert -f vmdk sdb.vmdk -O raw sdb.dd

piątek, 18 marca 2016

VBoxManage: error: Cannot open the raw disk '/dev/sdb': VERR_ACCESS_DENIED

user@host:~$ vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
VBoxManage: error: Cannot open the raw disk '/dev/sdb': VERR_ACCESS_DENIED
VBoxManage: error: The raw disk vmdk file was not created
Ok co się stało?
VERR_ACCESS_DENIED przy open the raw disk '/dev/sdb'

Przyczyny?

1. W użyciu
2. Złe uprawnienia odczytu /dev/sdb

Rozwiązanie

1. Sprawdź czy jest zamontowany /dev/sdb
cat /proc/mounts | grep "sdb"
cat /proc/self/mounts | grep "sdb"
mount -l | grep "sdb"

unmount /dev/sdb jeśli potrzeba

2. chmod 777 /dev/sdb
3. Bez pierdolenia

sudo vboxmanage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdb
RAW host disk access VMDK file /home/user/usb.vmdk created successfully.
chown -R user:user /home/user/usb.vmdk
chmod 777 /home/user/usb.vmdk

Cześć :)

poniedziałek, 27 lipca 2015

Usuń linię zawierającą określony ciąg przy użyciu sed i nie tylko

Aby usunąć linię i pokazać ja na standardowym wyjściu używając sed:
sed '/wzór do dopasowania/d' ./plik
Aby bezpośrednio zmodyfikować plik (Używając GNU sed):
sed -i '/wzór do dopasowania/d' ./plik
Aby bezpośrednio zmodyfikować plik (Używając AWK):
awk '!/wzór do dopasowania/' plik > temp-plik && mv temp-plik plik
Aby bezpośrednio zmodyfikować plik i zapisać kopię zapasową (Używając Ruby(1.9+)):
ruby -i.bak -ne 'print if not /wzór do dopasowania/' plik
Aby bezpośrednio zmodyfikować plik (Używając GNU grep):
grep -v "grep -v "wzór do dopasowania" plik > temp-plik && mv temp-plik plik" plik > temp-plik && mv temp-plik plik
Aby zmodyfikować plik używając skryptu Shell(bash3.2+)
#!/bin/bash while read -r line do [[ ! $s =~ wzór do dopasowania ]] && echo "$line" done o mv o plik

środa, 8 lipca 2015

Jak pobrać plik z serwera za pomocą SSH?

W terminalu wpisz:
scp nazwa_uzytkownika@nazwa-hosta.pl:/var/logs/jakis-plik.txt /lokalny/katalog
zastępując nazwę użytkownika, nazwę hosta, zdalnego i lokalnego katalogu jako właściwe.
Jeśli chcesz uzyskać dostęp do EC2 (lub innej usługi, która wymaga autentykacji z kluczem prywatnym), należy użyć opcji -i:
scp -i key_file.pem nazwa_uzytkownika@nazwa-hosta.pl:/var/logs/jakis-plik.txt /lokalny/katalog
Źródło
: http://www.hypexr.org/linux_scp_help.php
: http://stackoverflow.com/questions/9427553/how-to-download-a-file-from-server-using-ssh