Tag Archives: command

Find and replace in Nano

Q: How to find and replace a string in Nano?

A: The answer is straightforward, while you are in Nano,

  1. Press Ctrl+\. Notice that a box appears in the bottom of the window
  2. Then type the string you are trying to find and press Enter
  3. Then type the string you want to replace and press Enter
  4. At this point Nano jumps to the first instance of what you are looking for and shows you a set of shortcuts to go and find one by one, by pressing y for accepting and n for skipping, or replace all by pressing a

Continue reading Find and replace in Nano

Run Java applications on Linux

There are still some companies out there that are trying to have a GUI (Graphical User Interface) for their web services specially in scientific society. Most of these application are written in Java and requires user to have a Java enabled machine to run on. All these companies support OSX and Windows but they don’t want to provide support for Linux (for some reason that is not clear for me!). So in this brief tutorial I’m going to answer the question in an easy way:

The question is, how should we run .jlnp file on Linux?
Continue reading Run Java applications on Linux

Remote logout user through SSH

I had an issue with my Ubuntu recently that the computer was not stopping screesaver and didn’t show me the login page after a screenlock. Most people usually try to forcefully shutdown by pressing and holding the power button for about 10 seconds. This is not a good choice specially when you have some services on that machine or having some other users logged in through SSH to that computer.

In this article I will briefly explain how to logout a specific user remotely through SSH without touching or terminating any service or any other user.

Continue reading Remote logout user through SSH

Save file/folder structure including permissions

It has always been a great concern to keep track of folder permissions since most of the lame errors in Linux are due to a permission denial by the system, and sysadmins should change some permissions from time to time to fix things. At this point having a good record of what has been changed is vital since in terminal there is no undo or Ctrl+z and you should keep track of what you are doing to reverse the change and correct the mistakes.

In this post I briefly want to present some lines of code that can help you keep track.

Continue reading Save file/folder structure including permissions

SSH “Host key verification failed” error

There is an annoying error which you get when you want to connect to the same IP via SSH but the server authentication key has been changed and you computer does not accept the risk to connect with a key other than the one you have used before.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending key in /home/user/.ssh/known_hosts:1
RSA host key for ras.mydomain.com has changed and you have requested strict checking.
Host key verification failed.

This can happen when you install a new OS on the server (or what ever you are trying to connect with via SSH) or if you have completely change the device on the other end (which is also the same case as changing the OS). This error is basically for your own security and safety but it annoys anyway 😀

In this article i’m going to explain few ways to resolve the issue:

Continue reading SSH “Host key verification failed” error

Add user or group to sudoers file

I had this issue for my Ubuntu and Pidora, so in this article you can have both solutions:

In Ubuntu

The problem I had was to add a user on an Ubuntu 14.04 at my work, so that someone else from the company can help me do some basic maintenance of the system (it was requested by my employee!), so this is how I did it after creating a user (new_user):

 gpasswd -a new_user sudo

This command will add the user new_user to the group sudo.

In Pidora

I was working with Pidora (which is a Fedora remix for Raspberry Pi) and I was about to run a command using sudo that I faced the following error:

[NixSOS@pidora ~]$ sudo iptables -L -n
[sudo] password for NixSOS:
NixSOS is not in the sudoers file. This incident will be reported.

and I was confused for a while and then I searched for a way to add my user in the “sudoers file” and I’m going to explain how to add a user or a group to sudoers file. This should work all major linux distributions.

Continue reading Add user or group to sudoers file

Map a network drive in Mac OSX

There are several places where you need to map a network drive to your computer, for example when you are in a company network and you want to have the shared network drive of your company domain on your computer. The term “mapping” is a technical term for mounting or loading a network drive to a computer.

For this purpose there are more than one way to do it and map the network drive to your Mac OSX and in this article I’m explaining two of those ways which are easier, faster and safer, one from Finder window and the other one from Terminal.

Continue reading Map a network drive in Mac OSX

Find MAC Address of your Mac or Linux

Sometimes when you want to connect your computer to a new network via ethernet cable, network administrators may ask for your ethernet port MAC address (a.k.a physical address). There are several ways to find this address which is basically a number in a specific format and I’m going to explain these ways for all Linux-based operating systems in this post.

Continue reading Find MAC Address of your Mac or Linux

Generate & Compare MD5, SHA1 for Files and Strings in Terminal

Most of the times when you download a file from internet, you will see a checksum or MD5 hash tag beside the download link so you can compare the checksum of the downloaded file with the original file. There are several security reasons for that, but the most common one is to eliminate the possibility of a special type of hacking called “Man in the middle”. In this type of hacking, the hacker usually sniffs and listens to the requests goes from your computer and tries to compromise the packets, but the best thing you can do to help the hacker is to request a very popular application that he has already prepared an infected version, so when you want to download the file, he will send his own infected version toward your computer and you will install that application, thinking that it is the original malware-free application !! so after installing the application, the hacker can do variety of dangerous things to your computer such as creating a backdoor, key-logging, screen capturing, infecting the entire trusted network and etc.

The only way you can avoid this type of hack is by checking the checksums. there are few awesome, useful and easy commands that can do this checking for you and I’m going to describe them in this article:

Continue reading Generate & Compare MD5, SHA1 for Files and Strings in Terminal

Install wget on Mac OS X

When you are a Linux user, you are so familiar to wget command. In simple words, it is a command to download file from a given URL and port. Most Linux users and some windows users are familiar to this handy command download tool and on most Linux distributions it is pre-installed, but on Max OSX it is not installed and Apple does not offer it in AppStore, so the suer should install it manually, which is so straightforward, fast and easy.

In this tutorial I want to describe how to install wget on Mac OS X.

Continue reading Install wget on Mac OS X