Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, May 31, 2017

Windows and Linux command recall compared

I prefer to use Linux, but sometimes I need to use Windows. What is frustrating is that sometimes the operating systems have essentially the same feature, but there are differences in implementation that can trip you up if you forget about them.

Often when you are working at the command line you will need to issue the same command  you used before.(or a similar command). With either Windows or Linux you can easily recall the last command by typing up arrow once or recall the command before that by typing up arrow twice. So far so good, but if you read at the finer details of command recall on Linux or Mac you can see there are quite a few differences to the way the feature is implemented on Windows.

Mostly the differences are different key combinations used which can be difficult to remember when you switch between both systems. However, there are a few things that are significant:
  1. The way recalling commands affects your place in history:

    Linux takes a simple view of command history, while Windows adjusts your perception of history depending upon whether you typed a command directly or recalled it from history. This is a tricky concept, so lets look at example. Suppose you had typed the following commands:

     > command a
     > command b
     > command c

    If you type up-arrow twice and then return, both Windows and Linux would execute 'command b' because this is the second last command, However, the two systems have a subtly different view of your command history after this. Linux takes the view that you typed command a/b/c/b and so if you type up-arrow twice you should get 'command c'. Windows agrees that 'command b' was the last command executed, but if you type up-arrow twice it gives you 'command a' because that was the command executed before 'command b'. If you want to recall 'command c' on Windows, you should type down-arrow.

    The Windows approach is probably superior because it makes it easier to recall a series of commands you executed some time ago, but it can be confusing and it is easy to trip up (especially when you switch between both systems).
  2. The way you search for previous commands:

    If you executed a command involving 'blog.txt' some time ago it might be tedious to have to keep typing up arrow to find it. Luckily both Windows and Linux provide a quick way to find the command in question.

    In Windows you would type the string 'blog.txt' and then hit the F8 key to see the last command containing that text. In Linux you first type CTRL-r and then start typing the text you want to match. As you are typing Linux will show you the command it would match for the text you have typed. The Linux way is clearly better because you can see how much text you need to type to match the command you want or you might decide to match on a different part of the command if you see lots of commands in your history containing the word 'blog.txt'.
  3. History persisting between sessions:

    In Linux your command history is stored in a file, which means that when you start a new session it automatically know your command history from a previous session. In contrast, Windows stores the command history in volatile memory so each new session starts with a clear slate, In general the Linux approach is much more useful, but there can be problems when you have two command windows open at the same time - the command history is effectively a combination of the commands typed in both windows which can be confusing.

Friday, June 19, 2015

Copying text to and from remote servers

When working with a remote server it is very useful to be able to copy text from the local machine to the remote server or visa-versa. Normally this can be done via the clipboard commands of ctrl-C/ctrl-V. However, this feature sometimes stops working for no clear reason which is very frustrating.

Luckily I have found out that there is a relatively easy way to fix this. There is a program which runs on the remote server that looks after synchronising the contents of the clipboard on the local and remote computers.  The problem is that it sometimes stops working and needs to be restarted.

The VNC protocol is normally used to connect to Linux type systems and in this case the program in question is called vncconfig. It can be restarted by launching a terminal window on the remote system and typing the command:

   killall vncconfig ; vncconfig -nowin &

The RDP protocol is normally used to connect to Windows type servers. In this case the program which does the synchronisation is called rdpclip.exe and the procedure to restart it is only slightly more complex.

Open a command window on the remote system and type taskmgr.exe - the following dialog should appear and you need to click on the processes tab and locate a process with an image named rdpclip.exe. If you have problems spotting it, click on the "Image Name" column header to sort processes by image name. Once you find the process right-click on it and select "end process". This will ask you for confirmation. Once you confirm you can go back to your command prompt and type rdpclip.exe then cut and paste should be working again.




Wednesday, May 15, 2013

Seamless sharing between Linux and Windows

I am a big Linux fan, but sometimes my work requires me to work on Windows based machines. To do this I use the Remmina application to allow me to connect my laptop's screen, keyboard and mouse to the remote machine.

The main function of Remmina is to facilitate remote interaction through the VNC protocol for Linux servers and the RDP protocol for Windows servers However another thing that many people struggle with is the need to share files between the local machine and the remote server. This is possible, but can be tricky to set up. For this reason the Remmina dialog for setting up a new connection includes a simple check-box which allows you to specify that you want to share one of your local directories with the remote machine.

When you make this selection Remmina will automatically configure a SMB share for the directory for the directory that you selected. Then it connects to the share on the target machine so you will see a shared drive listed in Windows Explorer on your target Windows machine (see the example screenshot).

I am not aware of any tools for file sharing in the opposite direction (i.e. sharing files between a Windows Laptop and a Linux server). However, I would be very surprised if there were not several tools available to meet this need. Maybe one of the readers of this blog could post a comment with a link to such a tool.