linux:system

Sprawy dot. systemu Linux

W kupie i na temat: Easy Linux tips project

Co jakiś czas trzeba instalować po raz kolejny Linuxa na kolejnym komputerze. Kiedy powstanie mechanizm skryptowy, który pozwoli raz a dobrze zanotować wszystkie te programiczki, które chcemy i powinniśmy mieć na naszej jednostce, żeby z satysfakcją i spokojem jej używać?

Narzędzia, które działają w terminalu i bardzo usprawniają pracę.

  • htop - lepszy top
  • ncdu - tekstowe skanowanie wielkości zajętości katalogów na dysku
  • nmap - wszystko, co się da, o zdalnym hoście dowiesz się dzięki niemu
  • tmux - terminal multiplexer (powielacz okien w terminalu)
  • p7zip-full p7zip-rar - pakery dla 7zip i rar …
  • texlive-full
  • texlive-lang-all
  • texlive-extra-utils
  • latex2html
  • latex2rtf
  • texmaker
  • texworks
  • tth
  • lyx
  • pdf2djvu
  • pdf2svg
  • poppler-utils
  • pdftk
  • ghostscript
  • qpdf
  • htmldoc
  • e2ps
  • diffpdf
  • html2text
  • html2markdown
  • html2ps
  • tth
  • txt2html
  • t2html
  • pandoc
  • odt2txt
  • stx2any
  • xfpt
  • vim
  • autogen
  • dos2unix
  • wv

Create a backup of what packages are currently installed:

dpkg --get-selections > list.txt

Then (on another system) restore installations from that list:

dpkg --clear-selections
sudo dpkg --set-selections < list.txt

To get rid of stale packages

sudo apt-get autoremove

To get installed like at backup time (i.e. to install packages set by dpkg –set-selections)

sudo apt-get dselect-upgrade

Albo lista wrzuconych komend instalacji

To list all packages intentionally installed by apt commands, run the following :

( zcat $( ls -tr /var/log/apt/history.log*.gz ) ;\\
cat /var/log/apt/history.log ) | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep '^Commandline:'

This provides a reverse time based view, with older commands listed first:

Commandline: apt-get install k3b
Commandline: apt-get install jhead

Installation data also showing synaptic usage, but without details (the same with installation date) :

( zcat $( ls -tr /var/log/apt/history.log*.gz ) ; \\
cat /var/log/apt/history.log ) | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep -B1 '^Commandline:'

providing the following:

Start-Date: 2012-09-23  14:02:14
Commandline: apt-get install gparted
Start-Date: 2012-09-23  15:02:51
Commandline: apt-get install sysstat
Or (with zgrep and removing update messages):
 
zgrep -hE '^(Start-Date:|Commandline:)' $(ls -tr /var/log/apt/history.log*.gz ) | egrep -v 'aptdaemon|upgrade' | egrep -B1 '^Commandline:'

Lepsze niż sprawdzanie w pętli…

du -hx --max-depth=1 /

Najpierw:

sudo apt-get autoclean
sudo apt-get autoremove

Rozważ, czy na tym komputerze potrzebujesz te wszystkie zainstalowane programy:

dpkg --get-selections | grep -v deinstall

Jeżeli chcesz zobaczyć, czy przypadkiem nie masz tam jakiegoś puszystego pakietu, wypytaj po nazwie, jak np.:

dpkg --get-selections | grep -v deinstall | grep office

Potem:

Porada znaleziona na Askubuntu

Since the case involves a system with 100% HD usage, so, installing any application will not work. The only safe option is to delete unnecessary files first.

First in row would be temporary files

sudo rm -rf /tmp/*

Second, delete the cached applications. These are the binaries of applications and upgrades downloaded through the lifespan of the system. Normally this would be no less than 500 MB in an average Ubuntu system with one year of operation, and would give you a breather to install another apps.

sudo rm /var/cache/apt/archives/*deb

Then I would recommend deleting old log files

sudo rm /var/log/*gz

By this you would have at least free space of around 700 MB. This will allow you to work with utilities and install new ones.

Then I would install ncdu, which is a fast utility to scan the whole harddisk, and order directories by size. It is really fast, and works like a charm.

sudo apt-get install ncdu

then run it with the command

sudo ncdu /

The slash after ncdu is to scan from the root directory.

All the above works in ubuntu server as well as Desktop. Now, after doing all the above, and you are running on a Desktop environment, then , you can go for GUI utilities such as ubuntu-tweak (which is excellent by the way) and delete the old kernels. I usually keep the latest kernel, and the one before the latest, in case of upgrade failures.

Hope that this would help.

blkid

Niech program ten będzie się nazywał filename:

sudo su
cd /etc/init.d/
ln /path/to/filename filename
#############################
# jeśli trzeba to:
chmod +x /path/to/filename
#############################
sudo update-rc.d filename defaults 

Ale to nie zawsze działa. Lepiej zrobić skrypt, jak np. qbittorrent-nox-daemon: qbittorrent-nox-daemon.text

Od dawna chciałem odpalić server Calibre, żeby mieć dostęp do książek z różnych stron, ale też żeby w razie czego móc udostępnić moje zbiory innym. Okazuje się, że w połączeniu z poradą piętro wyżej oraz plikiem konfiguracyjnym stąd powinno dać się to zrobić.

Pamiętajmy, że ewentualne ręczne opcje serwera Calibre można ustawić dzięki tej pomocy.

RADA STĄD

  • Wrzucić poniższy kod do pliku w /etc/init.d/nazwaplikustartujacegodropboxa, * poprawić zmienną DROPBOXUSERS wpisując tam juzerów, którym Dropbox ma startować ze startem systemu (w ten sposób można mieć kilka kont Dropboxa!)
  • odpalić: sudo update-rc.d nazwaplikustartujacegodropboxa defaults'' <code> #!/bin/sh #dropbox service DROPBOXUSERS=„user1 user2” DAEMON=.dropbox-dist/dropbox start() { echo „Starting dropbox…” for dbuser in $DROPBOXUSERS; do HOMEDIR=getent passwd $dbuser | cut -d: -f6 if [ -x $HOMEDIR/$DAEMON ]; then HOME=„$HOMEDIR” start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON fi done } stop() { echo „Stopping dropbox…” for dbuser in $DROPBOXUSERS; do HOMEDIR=getent passwd $dbuser | cut -d: -f6 if [ -x $HOMEDIR/$DAEMON ]; then start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON fi done } status() { for dbuser in $DROPBOX_USERS; do dbpid=pgrep -u $dbuser dropbox if [ -z $dbpid ] ; then echo „dropboxd for USER $dbuser: not running.” else echo „dropboxd for USER $dbuser: running (pid $dbpid)” fi done } case „$1” in start) start ;; stop) stop ;; restart|reload|force-reload) stop start ;; status) status ;; *) echo „Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}” exit 1 esac exit 0 </code> === KONCEPCJA: jak odpalić wiele kont Dropboxa dla jednego juzera? === Powiedzmy, że chcemy mieć więcej niż 1 konto na Dropboxie, damy radę tym jakoś zarządzać, ale chcemy, żeby dostęp był z jednego konta użytkownika (bo po co mamy latać po wielu kontach?) Najpierw zakładamy juzerów: <code> useradd dropuser useradd dropusr passwd dropuser passwd dropusr </code> <code> mkdir Dropbox </code>
  • linux/system.txt
  • ostatnio zmienione: 2022/05/22 14:51
  • przez flamenco108