OS

Linux command line 2015

 

arch

Outputs the processor architecture.

$ arch

 

i686

 

cat

Outputs the contents of a file.

$ cat lorem.txt

 

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

 

cd

Change the working directory.

$ cd /bin

 

chgrp

Change group ownership of files.

$ chgrp games moo.txt

 

chmod

Change access permissions of files.

$ chmod +x helloworld

 

chown

Change file owner and group.

# chown root lorem.txt

 

cksum

Print CRC checksum and byte counts of each file.

$ cksum lorem.txt moo.txt

 

 

3570240675 453 lorem.txt
4294967295 0 moo.txt

 

cp

Copies a file.

$ cp lorem.txt copy_of_lorem.txt

Register to read more...

10 Practical Examples of Rsync Command in Linux

Rsync (Remote Sync) is a most commonly used command for copying and synchronizing files and directories remotely as well as locally in Linux/Unix systems. With the help of rsync command you can copy and synchronize your data remotely and locally across directories, across disks and networks, perform data backups and mirroring between two Linux machines.
 
Some advantages and features of Rsync command

 

  1. It efficiently copies and sync files to or from a remote system.
  2. Supports copying links, devices, owners, groups and permissions.
  3. It’s faster than scp (Secure Copy) because rsync uses remote-update protocol which allows to transfer just the differences between two sets of files. First time, it copies the whole content of a file or a directory from source to destination but from next time, it copies only the changed blocks and bytes to the destination.
  4. Rsync consumes less bandwidth as it uses compression and decompression method while sending and receiving data both ends.

 

Basic syntax of rsync command

 

# rsync options source destination
Register to read more...

How to install htop iftopCentOS 7.x

how to install htop iftop .... Commands to install EPEL repo on a CentOS Linux and RHEL 7.x

  1. Open a shell prompt.
  2. Or login to a host called server1 using ssh client.
  3. Install epel using the following command: yum -y install epel-release
  4. Refresh repo by typing the following commad: yum repolist

How to install RHEL EPEL repository on Centos 7.x or RHEL 7.x

The following instructions assumes that you are running command as root user on a CentOS/RHEL 7.x system and want to use use Fedora Epel repos.

Method #1: Install Extra Packages for Enterprise Linux repository configuration (recommended)

Just type the following yum command on a CentOS 7 or RHEL 7:

 
sudo yum install epel-release

Setup ConfigServer Security and Firewall (CSF) on CentOS 7

ConfigServer Security & Firewall (CSF) is a stateful packet inspection firewall (SPI), login/intrusion detection, and security application for Linux servers. It is a very popular security suite, but isn't officially supported yet on CentOS 7.

CentOS 7 uses firewalld rather than iptables. A quick internet search will show that many faithful CentOS users find firewalld far too complicated for their needs and are reverting back to iptables. Iptables was the standard firewall for CentOS 5 and 6.

Register to read more...

How do I connect to my GCE instance using PuTTY?

Setting up ssh keys

After you create new instances in the Developers Console, you can access them using:

When you connect using gcloud compute ssh, gcloud automatically handles creating an ssh key and inserting it into the instance.

If you want to use another ssh client without gcloud compute, you can insert your ssh key using the console. This is useful if you already have a public/private key pair and would like to use the same public/private key pair for your new instances.

To insert your keys using the Developers Console:

  1. Generate your keys using ssh-keygen or PuTTYgen for Windows, if you haven't already.
  2. Copy the contents of your public key. If you just generated this key, it can probably be found in a file named id_rsa.pub.
  3. Log in to the Developers Console.
  4. In the navigation, Compute->Compute Engine->Metadata.
  5. Click the SSH Keys tab.
  6. Click the Edit button.
  7. In the empty input box at the bottom of the list, enter the corresponding public key, in the following format:

    <protocol><public-key> username@example.com

    This makes your public key automatically available to all of your instances in that project. To add multiple keys, list each key on a new line.

  8. Click Done to save your changes.

    It can take several minutes before the key is inserted into the instance. Try connecting with ssh to your instance. If it is successful, your key has been propagated to the instance.