Tuesday, July 7, 2015

Personal linux command references (Debian command)

Note: these are command references for personal usage, you may use them as references freely with your own responsible. No warranty for any damages causing bay these references.

To show model

# dmidecode -s system-version
IdeaPad Gaming 3 15ARH7
16GB DDR5-4800 each slot manufacture tested

To show ram slot

# lshw -class memory

or

# dmidecode -t memory

Using ssh : remote to server using secure channel

$ ssh -l [user_name] [servername_or_ip]  

scp : upload to server using secure channel (secure copy) 

$ scp [file_source_to_upload] [user_name]@[servername_or_ip]:[full_path_destination_folder]

Using tar.gz 

To compress

$ tar -cvf [file_name.tar] [folder_to_archive]

To decompress from tar.gz

$ tar -xvf [file_name.tar]
$ tar -czvf BoyerMoore.tar.gz  ./BoyerMooreCopyPaste

Using p7zip

decompress

$ p7zip -d ./Kramaning.4.3.7z 

compress folder

$ 7z a kramaning.7z ./Kramaning/*

Restart lightdm xfce desktop server

# systemctl start lightdm
# systemctl status lightdm

User management

To Add user

# adduser user_id --home /home/user_id

To delete user and home directory

# deluser --remove-home user_id

To delete user and all related files and folders

# deluser --remove-all-files user_id

Disk Management

To show disk using lsblk

# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0 476.9G  0 disk
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part
├─nvme0n1p3 259:3    0 162.2G  0 part
├─nvme0n1p4 259:4    0   166G  0 part
├─nvme0n1p5 259:5    0   9.8G  0 part
├─nvme0n1p6 259:6    0   7.5G  0 part [SWAP]
├─nvme0n1p7 259:7    0 129.3G  0 part /
└─nvme0n1p8 259:8    0     2G  0 part 

To show disk using idblk

# blkid
/dev/nvme0n1p7: UUID="df7ae6ac-f4ff-429e-9fb4-1a5f45e34f5e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="94d61bfb-c413-4068-a231-89f12c26c343"
/dev/nvme0n1p5: LABEL="DATASHARE" UUID="A2FF-3F28" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="8be24844-0267-48c4-9c9c-0eb07b682984"
/dev/nvme0n1p3: LABEL="Windows-SSD" BLOCK_SIZE="512" UUID="9CB05AC3B05AA414" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="8996591a-1889-4be3-b932-11621d47ce94"
/dev/nvme0n1p1: LABEL_FATBOOT="SYSTEM_DRV" LABEL="SYSTEM_DRV" UUID="885A-5545" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="2ca7a85e-49bc-4ff5-8e2a-bf8d82f26ed9"
/dev/nvme0n1p8: LABEL="WINRE_DRV" BLOCK_SIZE="512" UUID="B0825B60825B29DC" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="0df86072-3532-4140-a733-79093411909c"
/dev/nvme0n1p6: UUID="7fef573b-5f9a-4c4e-a440-5c6cf459b965" TYPE="swap" PARTUUID="20da031c-ccd4-46d1-bc74-8c8f4dba0903"
/dev/nvme0n1p4: LABEL="mydata" BLOCK_SIZE="512" UUID="2698F69298F65FAB" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="13ee1824-6ae9-4982-ad57-68c55d6586b9"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="274d0d21-cb88-4b51-8a27-3290a4bee067"

To show disk using fdisk

# fdisk -l
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Micron MTFDKCD512QFM-1BD1AABLA          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8CA19B9D-CFAB-4CC5-917E-96F2BD8BC30B

Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048     534527    532480   260M EFI System
/dev/nvme0n1p2    534528     567295     32768    16M Microsoft reserved
/dev/nvme0n1p3    567296  340758527 340191232 162.2G Microsoft basic data
/dev/nvme0n1p4 340758528  688916479 348157952   166G Microsoft basic data
/dev/nvme0n1p5 688916480  709396479  20480000   9.8G Microsoft basic data
/dev/nvme0n1p6 709398528  725022719  15624192   7.5G Linux swap
/dev/nvme0n1p7 725022720  996118527 271095808 129.3G Linux filesystem
/dev/nvme0n1p8 996118528 1000214527   4096000     2G Windows recovery environment

To show disk using parted

# parted -l
Model: Micron MTFDKCD512QFM-1BD1AABLA (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  274MB  273MB   fat32           EFI system partition          boot, esp
 2      274MB   290MB  16.8MB                  Microsoft reserved partition  msftres
 3      290MB   174GB  174GB   ntfs            Basic data partition          msftdata
 4      174GB   353GB  178GB   ntfs            Basic data partition          msftdata
 5      353GB   363GB  10.5GB  fat32           Basic data partition          msftdata
 6      363GB   371GB  8000MB  linux-swap(v1)                                swap
 7      371GB   510GB  139GB   ext4
 8      510GB   512GB  2097MB  ntfs            Basic data partition          hidden, diag, no_automount

To Switch from Desktop to shell: ctrl + alt + f1

To Switch from shell to Desktop: ctrl + alt + f7