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

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

1.) The easy and heavy way to do this is to go use YAST (via GUI or ncurses):

YAST then -> System then -> Language 

In the language list you can pick whichever language you want to install character font support but in this example we focus on CJK /or Chinese, Japanese, Korean Languages.

Once you click Chinese, Japanese, Korean Languages, press ok and it will start downloading and installing the packages, this can take awhile as opensuse will download a lot of packages and still depends on your machine and net connection too

The Problem or rather issue with this is it will install everything with the including the kitchen sink approach, it will install so much packages than needed or rather what i call an overkill to support so many fonts and packages for the chosen languages, in the second option i will explain a more leaner way to install CJK language character support and break it down to each of the CJK languages


2.) This second option will be using the Command Line only no GUI, issue command in terminal:

# zypper install arphic-ukai-fonts arphic-uming-fonts ipa-ex-mincho-fonts ipa-mincho-fonts ipa-pmincho-fonts xano-mincho-fonts baekmuk-bitmap-fonts baekmuk-ttf-fonts

or with sans noto google fonts for CJK

# zypper install arphic-ukai-fonts arphic-uming-fonts ipa-ex-mincho-fonts ipa-mincho-fonts ipa-pmincho-fonts xano-mincho-fonts baekmuk-bitmap-fonts baekmuk-ttf-fonts noto-sans-cjk-fonts

In this one command it will install Chinese, Japanese, Korean Font support, below you can choose what to install for CJK support, lets you wanted to install just a leaner version for Japanese or Korean you can just install:

Japnese packages:
ipa-ex-mincho-fonts ipa-mincho-fonts ipa-pmincho-fonts xano-mincho-fonts

so issue command in terminal:
# zypper install ipa-ex-mincho-fonts ipa-mincho-fonts ipa-pmincho-fonts xano-mincho-fonts

Korean packages:

baekmuk-bitmap-fonts baekmuk-ttf-fonts

so issue command in terminal:
# zypper install baekmuk-bitmap-fonts baekmuk-ttf-fonts

Chinese: Actually the chinese packages include several language support including japanese and korean but only partial support in arphic-ukai-fonts arphic-uming-fonts, to show what I meant on what languages are exactly supported in the chinese package details:
arphic-ukai-fonts: contain both Big5 and GB2312 charsets plus some european characters.
    Currently it fully supports the following charsets:
    ISO8859-1,2,3,4,7,9,10,13,14,15 Big5 GB2312-80 Bopomofo Extensions for
    Hakka, Minnan (Unicode 4.0) and MBE variants using the Stylistic
    Alternatives (salt) feature from the OTF spec.
    Partly support is implemented for: HKSCS CNS 11643 GB18030 Japanese
    Korean
                                                                                                  
arphic-uming-fonts: contain both Big5 and GB2312 charsets plus some european characters.                                                                                                   
    Currently it fully supports the following charsets:                                                                                                                    
    ISO8859-1,2,3,4,9,10,13,14,15 Big5 GB2312-80 HKSCS 2004 Bopomofo
    Extensions for Hakka, Minnan (Unicode 4.0) and MBE variants using the
    Alternatives (aalt) feature from the OTF spec.
    Partly support is implemented for: CNS 11643 GB18030 Japanese Korean


Anyways to install issue command in terminal:

# zypper install arphic-ukai-fonts arphic-uming-fonts


Alternatively there is the Google SANS NOTO Fonts you can just install the noto-sans-cjk-fonts: which contains Chinese, Japanese, Korean Font Support from google sans noto CJK fonts, issue command in terminal:
# zypper install noto-sans-cjk-fonts

However this font package though is about 70+MB Download but it will install for support on all 3 CJK languages, you can choose to just install this or install it with the other packages mentioned above, but this by itself can support all 3 langauges, though with a bigger download size, however even if you install all the packages mentioned in this article, it still wont be as much as the gargantuan amount of packages opensuse will install with option 1 mentioned earlier with GUI and ncurses YAST way.




NOTES:
- All fonts packages mentioned here are available from openSUSE-Tumbleweed-Oss REPO or your respective opensuse version OSS REPO, so just make sure you have the OSS repository enabled in your zypper repo list
- 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
- You could just install everything mentioned here and rebuild the cache font list in one go with this command:
# zypper install arphic-ukai-fonts arphic-uming-fonts ipa-ex-mincho-fonts ipa-mincho-fonts ipa-pmincho-fonts xano-mincho-fonts baekmuk-bitmap-fonts baekmuk-ttf-fonts noto-sans-cjk-fonts && fc-cache -fv

Clamav Linux Anti-virus

Clamav Linux Anti-virus
First Install Clamav:
Install clamav in Archlinux:
$ sudo pacman -Sy clamav
Install clamav in Slackware from a slackbuild script from slackbuilds.org
Install clamav in Debian:
$ sudo apt-get install clamav 
Install clamav in OpenSUSE:
$ zypper install clamav 
Check the clamav version:
$ clamdscan -V

Terminal Usage:

At first you have to update the virus definitions with:
# freshclam
Then you can scan for viruses.
# clamscan OPTIONS File/Folder 
If necessary start with root permissions: sudo clamscan.
Examples:
  • To check all files on the computer, displaying the name of each file:
    # clamscan -r /
    
  • To check all files on the computer, but only display infected files and ring a bell when found:
    # clamscan -r --bell -i /
    
  • To scan all files on the computer but only display infected files when found and have this run in the background:
    # clamscan -r -i / &
    
    Note - Display background process's status by running the jobs command.
  • To check files in the all users home directories:
    # clamscan -r /home
    
  • To check files in the USER home directory and move infected files to another folder:
    # clamscan -r --move=/home/USER/VIRUS /home/USER
    
  • To check files in the USER home directory and remove infected files (WARNING: Files will be removed):
    # clamscan -r --remove /home/USER
  • Another possibility is to move the infected files to another folder with the option --move=FOLDER, so you can later check which files of them maybe not infected or a virus.  example:  
    # mkdir -p home/USER/QUARANTINED && clamscan -r --move=/home/USER/QUARANTINED /home/USE
  • To see more options:  
     # clamscan --help 
     
To put all the infected files list on a particular file: 
# clamscan -r /path-to-folder-to-scan/ | grep FOUND >> /path-to-file/clamav-log.txt


Updating Clamav:

Update clamav in command line:

# freshclam 



Clamav Common Update Problems and Troubleshooting:


1.) If you get an error saying something like:

ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).

The Fix is - Check file permissions and make clamav runnable with your user or better run it with sudo or as root


2.) If you get an error like this despite running as root or with sudo with freshclam update command:

ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
The Fix is - Delete the file ( /var/log/clamav/freshclam.log) with this command:
# rm -rf /var/log/clamav/freshclam.log

for a GUI for clamav, install clamtk (debian)


# apt-get install clamtk
Clamav Config Files: 
The Config file of clamav updater is in etc/clamav/freshclam.conf 
The Config file of the main clamav scanner is in /etc/clamav/clamd.conf

How to Burn a Bootable ISO Image to Disc in a Linux Terminal

How to Burn a Bootable ISO Image to Disc in a Linux Terminal:


There are many good free GUI apps to burn bootable linux iso images to disc in linux like k3b, brasero, xfburn and even the many free GUI burner apps for windows such as CdBurnerXP, ImgBurn, Infrarecorder, Active ISO Burner, BurnCDCC,  Free ISO Burner, ISOBurn, ISO Recorder, Passcape ISO Burner, ISO Workshop, Free Any Burn, Windows 7 Built-in Disc Image Burner etc etc, and even free linux CLI apps like cdrecord and many others, in this article however I will just mention 3 quick command line apps that are most common in linux distributions and mention an extra 4th choice, thats a menu driven linux CLI burning app for last

In the examples used here the default internal burner of the laptop is set as /dev/sr0, If your burner is not /dev/sr0, replace the device with the one your system uses.

Insert your blank CD/DVD/BD-R/RW then choose a method below


1.) wodim, issue command at terminal:

# wodim -v -eject -data -dao dev=/dev/sr0 speed=4 /path-to-bootable-linux-iso/foo.iso

- It is recommended to run wodim as root even if you can run it as a normal user to avoid errors and instability, read more about it in the notes below, and check the link provided there for further reading.
- For choosing Write Modes use DAO as primary choice or as a secondary choice use SAO for burning bootable ISO to disc, when using wodim anyways if you issue -dao as an option and for some reason its not possible to use DAO, wodim will automatically switch to using SAO, so to be safe just use the option DAO as -dao
- For wodim if the typical format of /dev/<foo> (/dev/sr0 here), doesnt work, issue the command:

# wodim  --devices

- A sample output of a laptop say for example with an internal DVD writer and another external USB DVD Writer drive plugged in will show:

wodim: Overview of accessible drives (2 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sg1'    rwrw-- : 'HL-DT-ST' 'DVDRAM GUD0N'
 1  dev='/dev/sg4'    rwrw-- : 'Optiarc' 'DVD RW AD-7560S'
-------------------------------------------------------------------------

- Note how /dev/sr0 is referenced as /dev/sg1 with wodim and /dev/sr1 referenced as /dev/sg4 with wodim, but when you use lsblk command the output would show:

sr0     11:0    1  20.5M  0 rom
sr1     11:1    1  1024M  0 rom

- Both devices as /dev/sr0 as the internal laptop dvd writer and /dev/sr1 as the 2nd burner device as a usb plugged in external dvd writer
- So in this case if you want to use sr0 or sr1 devices for burning you can try:

(1st device, /dev/sr0)
# wodim -v -eject -data -dao dev=/dev/sg1 speed=4 /path-to-bootable-linux-iso/foo.iso

/or

(2nd device, /dev/sr1)
# wodim -v -eject -data -dao dev=/dev/sg4 speed=4 /path-to-bootable-linux-iso/foo.iso

- A sample verbose output of a successful DVD iso burn with wodim in terminal, using a gentoo linux live iso for example:

# wodim -v -eject -data -dao dev=/dev/sg1 speed=4 /home/lowfatdaemon/Downloads/Gentoo/livedvd-amd64-multilib-20160514.iso


TOC Type: 1 = CD-ROM
scsidev: '/dev/sg1'
devname: '/dev/sg1'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.36
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   :
Vendor_info    : 'HL-DT-ST'
Identification : 'DVDRAM GUD0N    '
Revision       : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x0011 (DVD-R sequential recording)
Profile: 0x0012 (DVD-RAM)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0011 (DVD-R sequential recording) (current)
Profile: 0x0010 (DVD-ROM)
Profile: 0x000A (CD-RW)
Profile: 0x0009 (CD-R)
Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)
Using generic SCSI-3/mmc DVD-R(W) driver (mmc_mdvd).
Driver flags   : SWABAUDIO BURNFREE
Supported modes: PACKET SAO
Drive buf size : 294912 = 288 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size      : 12582912 = 12288 KB
Track 01: data  2839 MB      
Total size:     3261 MB (323:05.10) = 1453883 sectors
Lout start:     3261 MB (323:07/08) = 1453883 sectors
Current Secsize: 2048
HINT: use dvd+rw-mediainfo from dvd+rw-tools for information extraction.
Blocks total: 2298496 Blocks current: 2298496 Blocks remaining: 844613
Speed set to 5540 KB/s
Starting to write CD/DVD at speed   4.0 in real SAO mode for single session.
Last chance to quit, starting real write in    0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
Performing OPC...
Sending CUE sheet...
Starting new track at sector: 0
Track 01: 2839 of 2839 MB written (fifo 100%) [buf  60%]   3.9x.
WARNING: padding up to secsize.
Track 01: Total bytes read/written: 2977551360/2977552384 (1453883 sectors).
Writing  time:  594.333s
Average write speed   3.7x.
Min drive buffer fill was 55%
Fixating...
Fixating time:   35.103s
wodim: fifo had 46900 puts and 46900 gets.
wodim: fifo was 0 times empty and 26857 times full, min fill was 97%.

- Upon finishing the burning process, with the command using the option -eject, the system will automatically eject the disc, so you know its done.
- The successful iso burn result, was a bootable gentoo live DVD disc.


Troubleshooting Wodim:
- If  command "wodim  --devices" doesnt work or you get some error (being root), you can also try one of the following:

# wodim -scanbus

or 

# wodim dev=help --devices

- If you get issues or an error saying: cannot open SCSI driver, try using the command lsblk, and look for the corresponding rom devices, if you see sr(n) where n is a number like for example sr0 listed as rom, if so then, try using these commands:

# wodim dev=/dev/sr0 --devices 

or

# wodim dev=/dev/sr0 --scanbus

- If you get output similar to these below, from the above commands that means you're all good and the device/s work, just use the sr(n) label for devices in this case sr0 for burning:


wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sr0'      rwrw-- : 'HL-DT-ST' 'DVDRAM GUD0N'
-------------------------------------------------------------------------

and

scsibus2:
        2,0,0   200) 'HL-DT-ST' 'DVDRAM GUD0N    ' '1.00' Removable CD-ROM
        2,1,0   201) *
        2,2,0   202) *
        2,3,0   203) *
        2,4,0   204) *
        2,5,0   205) *
        2,6,0   206) *
        2,7,0   207) *

- You can also check to see if your kernel has support for burning or the proper kernel modules are loaded, Use lsmod command to check for modules named "sr_mod" and "sg", issue command:

$ lsmod | grep sr_mod

and

$ lsmod | grep sg

- If it is built into kernel then check output command of dmesg.
- You could also check permissions for device at /dev/sr0, issue command:

$  ls -l /dev/sr0

- Make sure to be root user when using wodim, to avoid errors and complications

-----------------------------------------------------------------------------------------------------------------------------------------------------------

2.) geniosimage, issue command at terminal:

$ genisoimage -r -J -o /path-to-bootable-linux-iso/foo.iso /dev/sr0

-----------------------------------------------------------------------------------------------------------------------------------------------------------

3.) growisofs, issue command at terminal:

(for CD)

$ growisofs -speed=4 -use-the-force-luke=dao -Z /dev/sr0=/path-to-bootable-linux-iso/foo.iso

/or

(for DVD)

$ growisofs -speed=4 -dvd-compat -use-the-force-luke=dao -Z /dev/sr0=/path-to-bootable-linux-iso/foo.iso

- The -dvd-compat option is also used so that a complete lead-out is written to the media for maximum compatibility.
- The option -use-the-force-luke sets the write mode in this example DAO is used (and it is recommended for burning bootable ISO files to discs), as -use-the-force-luke=dao, see notes below for some information about write modes

-----------------------------------------------------------------------------------------------------------------------------------------------------------

4.) bashburn, install bashburn and run it in command line:

$ bashburn

- Go through the menus to edit configurations and burn your iso


-----------------------------------------------------------------------------------------------------------------------------------------------------------


Notes:
- Make sure the apps you use here are installed in your system, if not then install them the way you would as your other apps in your chosen linux distribution
- Before burning downloaded bootable linux ISO file make sure the ISO file has been verified with its indicated checksum, from the upstream source where you got it from
- When burning bootable linux iso to disc (or even any data like audio files), its better to use a slower burning speed, safe choices are speeds of 2 or 4, slow burning is less error prone and allows the burning process to be done correctly and puts less stress on the CPU, burn in slow speeds to avoid making coasters (useless discs or a non-rewritable disc whose burn failed for any reason and cannot be repaired.).
- About Write Modes 101 (TAO, DAO, SAO, RAW, IPW):

    Track-At-Once
    CD content is subdivided into consecutive sets of sectors known as tracks. In Track-At-Once (TAO) mode the laser stopped and restarted between each track. This delay causes transitional areas, known as pre-gaps between the tracks. These cannot be avoided, but recorders which support Variable-Gap Track-At-Once can adjust the size of the pre-gap to a minimum of 2 sectors (2/75 of a second).
    With most drives TAO mode is required for multi-session recording.

    Disc-At-Once
    In Disc-At-Once (DAO) mode disc contents are recorded in a single pass without stopping the laser. This allows data to be written to the the pre-gap areas to avoid them altogether.

    Session-At-Once
    In Session at Once (SAO) mode multiple sessions can be recorded and finalized on a single disc. The resulting disc can be read by computer drives, but sessions after the first are generally not readable by CD Audio equipment.
    In Wodim, the DAO and SAO modes are synonymous. While most drives require multi-session discs to be authored in TAO mode, Wodim also has support for creating multi-session discs in SAO mode, assuming the underlying disc drive supports this.

    Raw Mode
    Disc images of CD-ROMs can be created either in raw mode (extracting 2,352 bytes per sector independent of the sector mode) or by obtaining only the actual data in the sector (2,048/2,336/2,352/2,324 bytes depending on the sector mode).The file size of raw mode disc images is always a multiple of 2,352 bytes. When such disc images are written to an optical media in raw mode, the 2,352 byte sectors, which already include the synchronization pattern and possibly error detection and correction data, are written to the disc as they are.

    Packet Writing
    Incremental Packer Writing (IPW) allows optical discs to be used in a manner similar to a writable block devices, i.e. it allows files to be created, modified or deleted on demand. This is achieved by writing a series of short (32k-256k) tracks on the disk in packet mode. CD-R/RW discs can be formatted into such packets, and the kernel pktcdvd module (packet writing driver) buffers up writes to the disk and transparently handles erasing and rewriting a whole packet at a time.


*In short when burning bootable linux ISO to disc, especially if its a DVD ISO it is best to just use DAO or as a secondary use SAO if DAO is not in the choices available for you, for writing audio CDs and you want a gap in between songs, use TAO.
- It is recommended to run wodim as root, as it says in ("http://linux.die.net/man/1/wodim"), excerpt "In any case, the user running wodim needs read and write access to the particular device file on a Linux system. It is recommended to be root or install the application as suid-root, because certain versions of Linux (kernel) limit the set of SCSI commands allowed for non-root users. Even if usage without root identity is possible in many cases, some device drivers still may fail, show unexplainable problems and generally the problems become harder to debug. The risk for buffer-underruns is also increased. See the PROCESS SCHEDULING PRIORITY section below for more details. " I've actually tried using it on a non-root user and it does give errors and problems, to avoid coasters and wasting your time just run it as root user.
- If for some reason you can't eject it with the button on your cd/dvd drive, or you just want to eject with a terminal command, you can eject it with the following commands:

$ eject

/or (to eject a specific rom device, especially if you have several rom devices plugged in where your rom is sr0 here if it isnt, replace the device with the one your system uses.)

$ eject /dev/sr0


  Reference Links:
- "ftp://ftp.slackware.com/pub/slackware/slackware-current/isolinux/README.TXT"
- "https://www.freebsd.org/doc/handbook/creating-dvds.html"

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