How to find out what device name in /dev directory is my DVD/CD Writer/Burner in the Linux Terminal

How to find out what device name in /dev directory is my DVD/CD Writer/Burner in the Linux Terminal


Best 3 ways on how to find out what device name in /dev directory is your DVD/CD Writer/Burner in the Linux Terminal: 



1.) By checking /proc/sys/dev/cdrom/ , issue command in terminal:

        $ cat  /proc/sys/dev/cdrom/

        /or

        $ less  /proc/sys/dev/cdrom/

        /or

        $ more  /proc/sys/dev/cdrom/

- a sample output in a laptop can look like this (showing other data including other device functions and even the drive speed):

drive name:        sr0
drive speed:        24
drive # of slots:    1
Can close tray:        1
Can open tray:        1
Can lock tray:        1
Can change speed:    1
Can select disk:    0
Can read multisession:    1
Can read MCN:        1
Reports media changed:    1
Can play audio:        1
Can write CD-R:        1
Can write CD-RW:    1
Can read DVD:        1
Can write DVD-R:    1
Can write DVD-RAM:    1
Can read MRW:        1
Can write MRW:        1
Can write RAM:        1

- The device name is: sr0
- So the device is in /dev/sr0


2.) With lsblk, issue command in terminal:

$ lsblk

- a sample output in a laptop can look like this:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk
├─sda1   8:1    0   300M  0 part
├─sda2   8:2    0   128M  0 part
├─sda3   8:3    0 110.5G  0 part
└─sda4   8:4    0   900M  0 part
sr0     11:0    1   4.4G  0 rom
loop0    7:0    0   765M  1 loop /lib/live/mount/rootfs/filesystem.squashfs
zram0  254:0    0  1002M  0 disk
zram1  254:1    0  1002M  0 disk
zram2  254:2    0  1002M  0 disk
zram3  254:3    0  1002M  0 disk
zram4  254:4    0  1002M  0 disk
zram5  254:5    0  1002M  0 disk
zram6  254:6    0  1002M  0 disk
zram7  254:7    0  1002M  0 disk

- In the TYPE Column look for ROM, so the device name here is sr0
- So the device is in /dev/sr0


3.) With inxi, issue command in terminal, make sure to type is as you see it, that O in Optical has to be capitalized, or just copy and paste it:

$ inxi -d | grep Optical

- a sample output in a laptop can look like this:

Optical: /dev/sr0 model: HL-DT-ST DVDRAM GUD0N dev-links: N/A

- The device name is sr0, in /dev as /dev/sr0

Where Best to Put your Local User Scripts in a GNU/Linux system?

Where Best to Put your Local User Scripts in a GNU/Linux system?

In General its best to put it in /usr/local/bin/

If you have to ask then Don't use these directories to store your user scripts:

/usr/bin, /sbin and /bin

Leave them for package-managed executables.

If you need the script for all users on your system (but you can also use this for one user), stick it in /usr/local/bin/. An advantage to this is that the directory is already in your PATH so there is no need to edit files.

But it can also depend in who will use the scripts



It depends on who will use your script:

    Yourself only - $HOME/bin 
    You and other local users - /usr/local/bin
    Root only - /usr/local/sbin

That way you have your own scripts separated from the distribution-provided binaries.

Extract Files from Archived Tarballs at the Terminal in Linux

Extract Files from Archived Tarballs at the Terminal in Linux


Modern tar recognizes the format by itself! One command works with any supported compression method.

$ tar xf archive.tar.xz
$ tar xf archive.tar.gz

$ tar xf archive.tar.bz2

$ tar xf archive.tar



Adding a v will make the output verbose (ex: tar xvf or tar xfv actually the order doesnt really matter)


(Legacy Support: For the older versions for tar.gz its $ tar xvfz somefilename.tar.gz but still applicable though like it mentions above xf is enough in most cases)

For the Bunzip2 or bzip2 or bz2 or tar.bz2 file in a single step, add the j switch:

$ tar xfj somefilename.tar.bz2 or $ tar xvfj somefilename.tar.bz2

Take not that its using a lowercase j as a capital J is for a different option switch as mentioned below

$ tar -xJf file.pkg.tar.xz

(The -J is the flag that specifically deals with .xz files.)

(For basic unzipping)
$ unzip file.zip

or

(to extract to a certain directory)

$ unzip file.zip -d destination_directory/


In 7zip:

This command lists the contents of the zip:
$ 7z l zipfile.zip

This command extracts the contents of the zip:
$ 7z x zipfile.zip


To unrar, within the directory (the e option extracts):
$ unrar e foo_file.rar

To unrar to a specified directory:
$ unrar e foo_file.rar destination_directory/

To unrar with its own original directory structure
$ unrar x foo_file.rar

How to Change Ownership of a Directory in Linux

How to Change Ownership of a Directory in Linux:

- This  is the format for the command:
    # chown -Rv username:group directory
(-R switch is to make it recursive that means to change the permissions for all files and directories inside of the directory)
(-v switch makes it verbose, its optional)

For Example:

- Say your using semplice linux (a debian sid based distro) in a live session and used # apt-get source foo to download and unpack the source code of a package, then you notice that you cant access the files or change the contents of that folder, because in live sessions semplice uses luckyuser as the normal user and the usergroup as well for that user, but to use apt-get source you have to be root, therefor downloading source with apt-get will make that directory under the group ownership of root, and when you check
file details you will see it listed with root:root meaning root user on root group, while any file made with luckyuser is normal user

- So lets say the source package was emacs-defaults-46.1 it was also unpacked from the package.tar.xz, but you cannot change the contents of the directory in anyway, despite even trying to change user rights on it, you have to change the group ownership

- To do that you look at the emacs-defaults_46.1.tar.xz ownership it says root:root meaning it belongs to root user as owner and group, to change it you need to make it luckyuser:luckyuser, so issue the command:

(the command format is: # chown -R username:group directory)

# chown -Rv luckyuser:luckyuser emacs-defaults-46.1

- This changes ownership to luckyuser from root, now all the settings allowed to root is allowed to luckyuser user and group
- You can now edit the directory and all of its contents or even delete it completely



How to Upgrade a Specific Package and Nothing Else in Debian:

How to Upgrade a Specific Package and Nothing Else in Debian:

# apt-get install --only-upgrade <packagename>

ex:

# apt-get install --only-upgrade htop

- This command will only upgrade the already installed htop package in your debian system, and not upgrade anything else

Install Asian CJK Langauge Font Character Support in Debian (in this case Japanese, Chinese, Korean)

Install Asian CJK Langauge Font Character Support in OpenSUSE (in this case Japanese, Chinese, Korean):


Issue command at terminal:

# apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core xfonts-intl-asian fonts-noto-cjk



 NOTES:

- List fonts with this command:


$ fc-list

- Rebuilds cached list of fonts (after installing fonts and it doesnt work, run this command):


$ fc-cache -fv

-  So a better way to install it all and rebuild the cache list of fonts after in one command:


# apt-get install fonts-arphic-ukai fonts-arphic-uming fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core xfonts-intl-asian fonts-noto-cjk && fc-cache -fv

How to Fix Common Broken Dependencies Problem with APT in Debian Linux

How to Fix Common Broken Dependencies Problem with APT in Debian Linux:
Example with Google Chrome

*Fixing Dependencies with apt-get -f install After installing a .deb Binary with dpkg

*After downloading Google Chrome Debian from Google, then installe it with dpkg

# dpkg -i google-chrome-*.deb

Selecting previously unselected package google-chrome-stable.
(Reading database ... 118596 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (52.0.2743.82-1) ...
dpkg: dependency problems prevent configuration of google-chrome-stable:
 google-chrome-stable depends on fonts-liberation; however:
  Package fonts-liberation is not installed.
 google-chrome-stable depends on libappindicator1; however:
  Package libappindicator1 is not installed.

dpkg: error processing package google-chrome-stable (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.59) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for menu (2.1.47) ...
Errors were encountered while processing:
 google-chrome-stable

*Google Chrome was installed but it had some errors with some missing dependencies, doing 
# apt-get -f install 
, fixes this

Reading package lists... Done
Building dependency tree      
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  fonts-liberation libappindicator1 libdbusmenu-gtk4 libindicator7
The following NEW packages will be installed:
  fonts-liberation libappindicator1 libdbusmenu-gtk4 libindicator7
0 upgraded, 4 newly installed, 0 to remove and 757 not upgraded.
1 not fully installed or removed.
Need to get 1,031 kB of archives.
After this operation, 2,566 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ftp.debian.org/debian unstable/main amd64 fonts-liberation all 1.07.4-1 [835 kB]
Get:2 http://ftp.debian.org/debian unstable/main amd64 libdbusmenu-gtk4 amd64 12.10.2-1 [90.8 kB]
Get:3 http://ftp.debian.org/debian unstable/main amd64 libindicator7 amd64 0.5.0-3 [52.6 kB]                                                                                                
Get:4 http://ftp.debian.org/debian unstable/main amd64 libappindicator1 amd64 0.4.92-4 [52.5 kB]                                                                                            
Fetched 1,031 kB in 7s (130 kB/s)                                                                                                                                                           
Selecting previously unselected package fonts-liberation.
(Reading database ... 118702 files and directories currently installed.)
Preparing to unpack .../fonts-liberation_1.07.4-1_all.deb ...
Unpacking fonts-liberation (1.07.4-1) ...
Selecting previously unselected package libdbusmenu-gtk4:amd64.
Preparing to unpack .../libdbusmenu-gtk4_12.10.2-1_amd64.deb ...
Unpacking libdbusmenu-gtk4:amd64 (12.10.2-1) ...
Selecting previously unselected package libindicator7:amd64.
Preparing to unpack .../libindicator7_0.5.0-3_amd64.deb ...
Unpacking libindicator7:amd64 (0.5.0-3) ...
Selecting previously unselected package libappindicator1:amd64.
Preparing to unpack .../libappindicator1_0.4.92-4_amd64.deb ...
Unpacking libappindicator1:amd64 (0.4.92-4) ...
Setting up libindicator7:amd64 (0.5.0-3) ...
Setting up fonts-liberation (1.07.4-1) ...
Setting up libdbusmenu-gtk4:amd64 (12.10.2-1) ...
Processing triggers for libc-bin (2.21-7) ...
Processing triggers for fontconfig (2.11.0-6.3) ...
Setting up libappindicator1:amd64 (0.4.92-4) ...
Setting up google-chrome-stable (52.0.2743.82-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for libc-bin (2.21-7) ...
Processing triggers for menu (2.1.47) ...

*Google Chrome now works, broken dependency issue now fixed


Further Notes:
- The command # apt-get -f install is usually used for when troubleshooting debian based system when there are installation dependency issues or upgrade issues after