Caps Lock problem in Ubuntu VMWare virtual Machine - keyboard

I'm running a vmware virtual machine (not vmware pro) on which I have given 2 GB RAM from my laptop . The problem is whenever I press caps lock when writing text inside the virtual machine and I get capital letters when I press it again and I write some text I get mixed letters ex. (ExAMPLe instead of example )
I went to my vm settings but I didn't find something about my keyboard functionality . I would appreciate your help with helping me solve this problem . (feel free to ask for more info that I should include about the question )

I had the same problem and fixed it by adding this line to the .vmx file for the Ubuntu VM:
mks.win32.useInjectedMagic=FALSE
Edit 2020-09-17: another user with the same problem had to apply a small adjustment, quoting the "FALSE" value:
mks.win32.useInjectedMagic = "FALSE"

Related

BGInfo fails to record free diskspace on Windows 10 64Bit because no JET installed

My goal is to graph a PC's disk free space over time in Excel. BGinfo worked on Windows 10 32bit to write to a text file each time it ran. I recently changed the disks in the machine and upgraded the windows to 64Bit at the same time.
Now BGinfo displays info on the desktop, but fails when trying to write to the text file. The error is:
"Database Support requires that Jet4.0 or later be installed. (Jet 0.0 detected)".
The machine is a headless box that runs overnight backups so it doesn't have Excel/Access which I think would install MDAC and Jet.
First - can I install JET4.0 on the machine? This would be ideal as the text file and spreadsheet would work without changes.
If JET is no-go how else can I generate a text file with the information I need? Something like this:
Date, Time, PC Name, Vol1, Vol1 Size, Vol1 Free Space, Vol2, Vol 2 Size, Vol 2 Free Space,
20191121,14:40:30,BACKUP-BOX,C:,931.12GB,555.55GB,E:,1800.00GB, 1234.56GB
I've looked a bit at WMIC but that generates multi-line output and I don't want to reinvent the wheel if there's an easier way.
wmic /node:"%COMPUTERNAME%" LogicalDisk Where DriveType="3" Get Name,DeviceID,Size,FreeSpace /format:csv
For anyone else with this issue:
The BGinfo download package includes two executables.
Both of them work fine to update the desktop info, but only Bginfo.exe (32bit) can write the data to Test/XLS/SQL file.
BGinfo64.exe throws up the MDAC / JET error that prompted my original question.

How to disable a Virtual Terminal in Yocto Linux

Would anyone know how to disable the virtual terminals in linux? I am using Yocto, Morty version on an i.MX6 processor. Even though our base distribution is Yocto, unfortunately we have diverged from building it with recipes, so this is more of a straight linux question than Yocto…
To give some detail as to my problem: It is for an embedded device that has an HDMI port - when I attach a terminal to the HDMI port it shows the Linux Penguin logo, a getty service and blanks out after 600 seconds. I just want to use the hdmi port as an output with nothing displayed on the output and I want it to stay on all the time.
I have found that the hdmi port maps to /dev/tty1 – when I type: echo “asdfasdf” > /dev/tty1 I see the characters output to the monitor.
Here are a few things I have tried to no avail – a lot of these are not needed if I can figure out how to disable it as a virtual terminal…
• I figured out how to disable the getty service but a cursor still blinks. I don’t even want a cursor to show
• I have tried to disable the display of the penguins by disabling the LOGO in the kernel config parameters - I commented anything with LOGO out:
CONFIG_LOGO=y
CONFIG_LOGO_LINUX_MONO=y
CONFIG_LOGO_LINUX_VGA16=y
CONFIG_LOGO_LINUX_CLUT224=y
To no avail. The logo still shows : .
• The fact that it blanks after 600 seconds is console blanking – I can see it set to 600 in the file: /sys/module/kernel/parameters/consoleblank. When I issue the command: echo -e '\033[9;0]'>/dev/tty1
It sets the console blanking to 0 and wakes the terminal. Being able to wake the console up is limited success but I would like to disable the virtual terminal altogether…
• I tried commenting out any virtual terminal defines in the config file to no avail:
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_HW_CONSOLE=y
CONFIG_VT_HW_CONSOLE_BINDING=y
Everything I have read suggests that /dev/tty1 is a virtual terminal or console. From what I read about the VT option, disabling the CONFIG_VT should do it:
VT — Virtual terminal Say yes here to get support for terminal devices
with display and keyboard devices. These are called "virtual" because
you can run several virtual terminals (also called virtual consoles)
on one physical terminal. You need at least one virtual terminal
device in order to make use of your keyboard and monitor. Therefore,
only people configuring an embedded system would want to say no here
in order to save some memory; the only way to log into such a system
is then via a serial or network connection. Virtual terminals are
useful because, for example, one virtual terminal can display system
messages and warnings, another one can be used for a text-mode user
session, and a third could run an X session, all in parallel.
Switching between virtual terminals is done with certain key
combinations, usually Alt-function key. If you are unsure, say yes, or
else you won't be able to do much with your Linux system.
But for some reason it doesn’t do anything!
• I found this thread; https://askubuntu.com/questions/357039/how-do-i-disable-virtual-consoles-tty1-6 among others, but none are much help since my distribution does not have any of the directories in the solutions offered in this thread or any others I have found. For instance I do not have a /etc/events.d nor do I have a /etc/default/console-setup file nor do I have a /etc/init directory… I imagine the reason for this is that my distribution uses systemd and the solutions are SysV based init maybe?
Disabling the logo or console blanking would not be necessary if I could just figure out how to disable that port as a terminal…
So does anyone have pointers or things I could try? I am relatively new (returning after 10 years - I worked with DNX 10 years ago v2.6 and it seems everything I knew about init is fairly obsolete lol) to linux so I am sure I am missing a lot…
Thanks,
- Chuck
I think I found the answer to my question. This is actually a frame buffer console documented here: Documentation/fb/fbcon.txt. From the documentation:
The framebuffer console (fbcon), as its name implies, is a text
console running on top of the framebuffer device. It has the
functionality of any standard text console driver, such as the VGA
console, with the added features that can be attributed to the
graphical nature of the framebuffer.
Commenting out the line
CONFIG_FRAMEBUFFER_CONSOLE=y
In the configuration file located in /arch/arm/configs will disable it.
Also this part of the documentation shows you how to disable it at runtime:
So, how do we unbind fbcon from the console? Part of the answer is in
Documentation/console/console.txt. To summarize:
Echo a value to the bind file that represents the framebuffer console
driver. So assuming vtcon1 represents fbcon, then:
echo 1 > sys/class/vtconsole/vtcon1/bind - attach framebuffer console
to
console layer echo 0 > sys/class/vtconsole/vtcon1/bind - detach framebuffer console from
console layer
When I issue the echo 0 command, the cursor stops blinking and starts blinking again when I issue the echo 1 command.
I think there is another way of doing it as well by modifying the Yocto build environment by putting the USE_VT="0" in the OpenEmbedded machine config file. The "USE_VT" variable is referenced by the sysvinit-inittab recipe. This answer was given to me from the Yocto Linux mailing list - but I have not tested it since we have diverged from Yocto...

Copying text from linux to windows notepad

I would like to know, how to copy the entire lines of text from vi editor in Redhat to a notepad in windows.
If the size of the text to be copied is minimal, it can be easily done by selecting the lines through mouse and copying to notepad. However I have come across the situation of copying thousands of lines.
I would rather use a file as the media, and use the sz -be coomand send the file to windows.As a suggestion, you can search google about rz/sz command for more details.
If i say straight forward answer then there is no way i guess,
but workaround is there,
Make a public share of samba (not more than 1 min)
Access from windows
Create empty file from windows
At Linux box run
cat {path_to_file_you_want_to_copy_content} >> /public/empty_file
for eg:
cat abc >> /public/empty.txt
Hope that resolves your problem.
If i say straight forward answer then there is no way i guess..,
but try below use cases..,
download and install winscp software and connect to your instance (your linux machine) using username and password. Then copy your files from linux to windows.
if your linux is a virtual machine (running on putty or vmware) using mouse you can directly copy the conent of file in vi editor in linux machine and paste in new or existed file in windows.

MacOS dot file delete for MS-DOS devices

Sometimes I have wanted to place my Mac files on a USB thumb drive or portable external hard drive to share with an MS-DOS, Linux, Unix or Microsoft Windows user, or use them on a non-Apple product such as a TV or media player. The problem is that all disk devices including USB sticks that have been attached to my MacOS computer will have innumerable files placed on them by MacOS that are invisible on the MacOS computer. These files are invisible on the Mac because their file names begin with a period "." or "dot" character followed by the name of a regular file on the device (e.g.: .fileFoo is created in reference to fileFoo). When I then eject the USB drive from my Mac and attempt to use it with a non-Apple product, it will not function correctly. For example, the device may freeze up or list many files and folders that cannot be used. This automatic creation of all the extra invisible files can also cause a nearly full external MS-DOS, Linux, Windows or Unix drive to act strangely when connected to a Mac computer, because there won't be enough space on the drive for all the MacOS hidden files.
I traced these problems to all those invisible dot files. I found some solutions online but none did exactly what I wanted so I created an AppleScript combined with a Shell script to solve this problem. I'll post it as an Answer to this question in case it's helpful for anyone else. But my real Question is, would anyone like to improve this script with error handling and comments or post an alternative perhaps all done with a single shell script or AppleScript?
[Edit] OK, I'm unable to post the Answer I created until 8 hours have passed, so I'll do that tomorrow. Will be fun to see what the experts here have come up with in the meantime. :)
Here is my clumsy answer to the Question posted above. The main drawbacks are lack of much error handling or commenting, and the complexity level for non-technical users who need to learn about making shell scripts executable. If it could all be done in an AppleScript, it might be much more useful for a wide range of users baffled by the dotfile problem.
Here's the Readme.txt file I've shared with the two scripts below:
noMacOSdots.app
-Introduction-
Sometimes you may want to share files with an MS-DOS or Microsoft Windows user, or a non-Apple product such as a TV or media player. The problem is that all disk devices including USB sticks that have been attached to a MacOS computer or other Apple device will have files placed on them by MacOS that are invisible to MacOS users. When you then eject the drive from your Apple product and attempt to use it with a non-Apple product, it will not function correctly. For example, the device may freeze up or list many files and folders that cannot be used.
The purpose of this app is to quickly and easily delete all of those un-needed invisible files placed by MacOS onto non-Apple drives. It is only useful for drives using the MS-DOS file format when they are to be used in MS-DOS type devices such as non-Apple TVs and music or video players. It is of no value for any drives, USB sticks, etc. that are using the MacOS file format. It may in fact cause some damage to such MacOS devices, and should be used with caution only after carefully reading and understanding the directions.
This app will delete hidden MacOS files from some drives attached to the computer on which this app is launched. Specifically, only drives with volume names that begin with the letters "MS" will be affected. Others, for example a drive named "InternalHD" will not be affected. Due to the simple nature of this app it will not give any indication of which files are deleted, or even whether ANY files were deleted. Since the app is free and the source code is included, you are free to modify and improve it if you have the time and skills.
IMPORTANT: Before using this app be sure that there are no MacOS devices attached to the Mac on which you run this app with volume names that begin with the letters "MS" (for example, a MacOS USB stick named "MS Smith"). Any such devices will have all hidden MacOS files that begin with a period "." deleted, and that may cause some problems in using those devices. By using the app you assume all responsibility for any problems that may arise.
-Installation-
1. If you have the file named noMacOSdots.zip, place it in the Utlities folder inside your Applications folder, then double-click it to unzip it.
2. Move the two noMacOSdots files ("noMacOSdots.app" & "noMacOSdots.sh") from the noMacOSdots folder created by unzip, into the Utilities folder leaving this "-ReadMe.txt" file behind.
NOTE: This app will only function when BOTH of those files are in the Applications/Utilities folder.
3. The app and support file are now installed in your Applications/Utilities folder, and if desired you can drag noMacOSdots.app into the Dock to create a shortcut for it.
4. Launch noMacOSdots.app and follow the on-screen directions carefully.
-Directions-
If you have MS-DOS format USB sticks or other drives used on a MacOS computer that you wish to clean up for use in MS-DOS computers or devices like TVs and games, follow these steps:
1. Ensure that the external drive's MS-DOS volume name begins with the letters "MS" (for example, you might name a USB stick "MS-USB4G").
2. Ensure that names of all attached MacOS drives do NOT begin with "MS" to avoid problems (for example, if your Mac's hard drive is named "Ms Smith" it could be damaged by this app).
3. Launch noMacOSdots.app and click the "OK" button when prompted.
4. Immediately eject all MS-DOS format external drives after this app displays a "Done" notice, to prevent MacOS from installing new hidden files on the MS-DOS drive.
Here's a simple AppleScript I made to call the shell script (I use a compiled "app" version):
tell application "Finder"
display dialog " -ATTENTION-
This app will delete hidden MacOS files from all attached drives that begin with the letters 'MS' and is only useful for drives using the MS-DOS file format when they are to be used in MS-DOS type devices such as non-Apple TVs and music or video players.
If you have MS-DOS USB sticks or other drives used on a MacOS computer that you wish to clean up for use in MS-DOS computers or devices like TVs and games, follow these steps:
1. Ensure that the external drive's volume name begins with the letters 'MS' (example: a USB stick named 'MS-USB4G').
2. Ensure that the names of all attached MacOS format drives do NOT begin with the letters 'MS' to avoid possibly damaging them (example: a disk named 'Ms Smith').
3. Launch this app and click the 'OK' button when prompted.
4. Immediately eject all MS-DOS format external drives after this app displays a 'Done' notice, to prevent MacOS from installing new hidden files on the MS-DOS drive.
If you understand and have performed the above steps, click the 'OK' button now to continue.
NOTE: All hidden MacOS files will be deleted
from attached drives with the letters 'MS' at
the start of their volume names.
To abort this app now and take no action on any files or drives, just click the 'Cancel' button." buttons {"OK", "Cancel"} default button 2
set junk to do shell script "/Applications/Utilities/noMacOSdots.sh &> /dev/null"
display dialog " -DONE-
MacOS hidden files deleted from any attached volumes with 'MS' at the start of their names.
Eject MS-DOS drives immediately after exiting this app, or MacOS may create hidden files on them." buttons {"OK"} default button 1
end tell
Finally, here's the shell script that goes with the two files above:
#/Applications/Utilities/noMacOSdots.sh
echo ""
echo ""
echo " **WARNING: Deleting hidden MacOS files on attached volume(s) whose names begin with 'MS'**"
echo ""
echo "Running dot_clean to save some MacOS info on selected drives..."
dot_clean -m --keep=mostrecent /Volumes/MS*
echo ""
echo "Deleting MacOS dot files on selected drives..."
find /Volumes/MS* -depth -name "\.*" -exec rm -rf {} \;
echo ""
echo "EJECT all selected drives NOW to prevent MacOS adding new dotfiles."
echo ""
exit 0

Ubuntu terminal in windows ? Can anyone explain the 'col' command in plain English for me?

Next week I am getting an exam on using basic commands and shell scripting using terminal in Ubuntu. Please help me out with two quick questions:
-Does a practice environment for the Ubuntu terminal exist? I don't want to dual boot with Linux, so I want to find somewhere I could practice using some basic terminal commands as Cygwin seems to be quite different from the ubuntu terminal.
-What does the col command in Linux do? The manual page is here: Link, but I find that hard to understand, and since it doesn't work in Cygwin, it's hard to interpret! Also, why would one use man piped to col -b -x?
Thank you very much and sorry for the probably silly questions!
You can use the Ubuntu LiveCD boot (boots up an Ubuntu system without actually installing it) and experiment with the Ubuntu terminal shell. Its actually the same CD as the standard Ubuntu installtion CD... you just chose "Try Ubuntu" instead of "Install Ubuntu" once it boots up:
https://help.ubuntu.com/community/LiveCD
col is program to filter out reverse-linefeeds (i.e. the backspace character) from text input. In the olden days of line printers, a common method to achieve boldface print was to print a character, then print a backspace character, then print the character again. This would make the printer strike the character twice in the same place. Some programs would emit text files formatted in this way (man is one such program)-- but if you then tried to display that text file to your terminal screen, you might end up seeing something like this: "here is b^Hbo^Hol^Hld^Hd text".
col -b simply filters text input to strip out those extra backspace and double-strike characters. The -x option converts tab characters to space characters, which might be useful if the output was formatted for a device with a particular tab width, but then displayed on a different device.
man pages often have the backspace/double-strike text embedded in them, so man piped into col was often useful.
Nowadays, most terminal emulators actually know how to handle the backspace/double-strike, so col doesn't get used as much.
Far better (easier to use, install, maintain, etc.) than Cygwin, and perhaps less resource-using than a virtual machine, is http://andlinux.org . That will give you a shell on your Windows desktop, and you can play with the col command to better understand it.
Win-bash is essentially the same shell as linux, but on windows. You can use this to experiment outside Linux but I'm not sure how effective it is.
Other options are virtual machines, and if you don't mind a reboot, you can install ubuntu with wubi which means it can be deleted from windows' add/remove programs when you are done with it. (Or just use the live disc)
Col has very limited use for most people, it only affects programs that write lines asynchronously as opposed to line by line...

Resources