Commands Commonly Used

menguin

Geek
Pinoy Techie
TO SHUT DOWN NOW:
sudo shutdown -h now

SHUTDOWN COMMAND TO RESTART:
sudo shutdown -r now

VIEW ERROR LOGS – TO SAVE AS A TEXT FILE:
less dmsg.txt

MAKE BACKUPS OF FILES BEFORE MODIFYING:
cp filename file.backup

RESTORE ORIGINAL FILE FROM A BACKUP:
cp file.backup file

TO UPDATE FROM THE THE TERMINAL INSTEAD OF THE UPDATE MANAGER:
sudo apt-get update

TO CHANGE DIRECTORIES:
cd name.of.directory

TO INSTALL ALL PACKAGES IN A FOLDER. CD INTO THE FOLDER THEN:
dpkg -i *.deb

CREATE A PACKAGES.GZ FOR DEBS IN A FOLDER TO USE AS A REPO. CD INTO THE FOLDER THEN:
sudo dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

TO ADD THE FOLDER TO THE SOURCES.LIST GO TO SYNAPTIC PACKAGE MANAGER-SETTINGS-REPOSITORIES AND ADD:
deb file:///home/username/foldername /

TO REPACK ALL INSTALLED APPLICATIONS TO .DEB FILES:
fakeroot -u dpkg-repack `dpkg –get-selections | grep -v deinstall | cut -f1`

TO DOWNLOAD SOFTWARE TO INSTALL LATER OR MOVE TO ANOTHER COMPUTER TO INSTALL:
apt-get install –download-only? (package)
THEN COPY ALL THE .DEBS FROM /VAR/CACHE/APT TO A CD/DVD, USB, OR BLUETOOTH

TO RESTORE GRUB AFTER WINDOWS INSTALL, MULTIBOOTING WITH LINUX, OR TO RESTORE FROM ANOTHER PROBLEM:
1. FIRST BOOT INTO LIVE SESSION AND OPEN TERMINAL: fdisk -l TO SEE WHICH PARTITION YOUR LINUX IS ON.
2. NOW WE MUST MOUNT THIS PARTITION: sudo mount /dev/sda1 /mnt WHERE “sda1” IS THE PARTITION WHERE LINUX IS MOUNTED.
3. INSTALL GRUB TO THE PARTITION YOU MOUNTED:
sudo grub-install --root-directory=/mnt/ /dev/sda NOTE: NOTE THE INSTALL GOES ON sda AND NOT “sda1”.
4. RESTART COMPUTER. REMOVE THE DISK AND BOOT TO DESKTOP. OPEN TERMINAL :
sudo update-grub
5. RESTART THE COMPUTER AND ALL IS DONE.

BACKING UP APPS LIST TO RESTORE ON A NEW INSTALL- BACKING UP TO A TEXT FILE AND RESTORING APPS ON A FRESH INSTALL:
sudo dpkg –get-selections > app-backup-list.txt
THIS WILL CREATE A TEXT FILE OF THE NAME app-backup-list.txt IN HOME FOLDER.
TO RESTORE THE APPS ON THE FRESH SYSTEM. TO RESTORE THE APPLICATIONS, FIRST MAKE SURE THAT THE FILE app-backup-list.txt IS IN THE NEW HOME FOLDER THEN IN A TERMINAL:
sudo dpkg –get-selections < app-backup-list.txt
sudo apt-get -y update
sudo apt-get dselect-upgrade

TO SPLIT A LARGE DIRECTORY INTO SMALLER PIECES TO BURN TO MULTIPLE DISKS, I USED THIS TO SPLIT REPOS INTO SMALLER PARTS TO PUT ON DVD'S. FIRST WE HAVE TO MAKE A LIST OF FILES TO BE MADE INTO ISO'S. OPEN A TERMINAL AND TYPE:
dirsplit -s 700m -e2 /path/to/directory
THEN TYPE:
ls vol*
THE ABOVE dirsplit COMMAND WOULD CREATE MKISOFS CATALOGS TO BURN TO 700MB CD'S, TO BURN TO DVD SWITCH 700M TO 4200M. NOW USE THE LIST FILE TO CREATE ISO'S TO BURN THAT CAN BE OPENED IN BOTH WINDOWS AND LINUX, IN TERMINAL TYPE:
mkisofs -o vol1.iso -D -r –joliet-long -graft-points -path-list vol_1.list
(CHANGE vol_1.iso AND vol_1.list TO vol_2.list AND vol_2.list AND SO ON FOR EACH ISO. WHEN ALL DONE WITH THAT, BURN THE ISO'S.

FOR DEBIAN ON A MULTIBOOT SYSTEM – IF DEBIAN WON'T REBOOT TO GRUB AND ONLY REBOOTS TO DEBIAN, OPEN A TERMINAL AND TYPE:
sudo gedit /etc/default/kexec
AND CHANGE LOAD_KEXEC=true TO LOAD_KEXEC=false
(USE GEDIT IN GNOME AND MOUSEPAD IN XFCE)
 

Similar threads


Top Bottom