Edit windows files in linux

Edit windows files in linux

Wine (originally an acronym for «Wine Is Not an Emulator») is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, Mac OSX, & BSD. This subreddit is for the discussion of using WINE to play video games.

Is there a way I can edit Windows .lnk shortcut files in Linux, or at least through a program in Wine?

Sometimes I want to be able to copy or alter the command line arguments specified in these files, and I’ve never managed to find a good way to do it in Linux.

In Windows, you can just right-click these files, go to «properties», and then meddle to your heart’s content. Since this is a function built into the OS, it’s understandable why there aren’t really any third party utilities out there to alter these files, at least none that I’ve managed to find.

I understand that a more native way of doing this, sort of, would be to create a .desktop file, but this is not what I want to do. Besides, in order to create one of these files, there are situations where I may have to copy some command line arguments found in the .lnk file.

The only (good) solution I can think of would be to fire up a Windows VM and alter the shortcuts from there, but this is a grossly inefficient way of doing things, and last I checked, Windows doesn’t let you save changes to a shortcut file unless all the paths in that file are correct.

I’ve tried looking at these files in a hex editor before too, and it’s hard to make sense of them. If anyone knows of any hex editor templates I can use to de-obfuscate these files, I’m all ears.

Источник

Wimlib: ImageX / DISM Alternative To Manipulate WIM Files In Linux [Ubuntu PPA]

Wimlib is a library that allows creating, modifying, extracting and mounting WIM (Windows Imaging Format) files. It comes with a free implementations of ImageX called «wimlib-imagex», available for both Linux and Windows.

WIM is a file-based disk image format developed by Microsoft for Windows Vista and later. The Windows Setup DVD uses such files for the installation process. For more information, see the WIM article on Wikipedia.

wimlib

Besides WIM extract, create and update support, this free software alternative to ImageX or DISM (Deployment Image Servicing and Management) allows users to mount WIM images, either readonly or read-write and on Linux, it can even be used to extract or create WIM images to/from unmounted NTFS volumes, by using ntfs-3g. Using it from Linux, you can back up, install or restore Windows directly from a WIM file.

Читайте также:  Linux запуск приложения из консоли

Extracting a WIM file can also be achieved by using p7zip (for example, you can extract a WIM file using Archive Manager, by renaming the file extension to .7z, or you can do it via command line, using «7z») however, the latest stable p7zip 9.20.1 seems to fail with Windows 8 WIM images. Wimlib on the other hand should handle Windows 8 WIM files properly.

  • Support for both Linux and Windows;
  • Apply/extract an image from a WIM file to a directory;
  • Apply/extract an image from a WIM file directly to a NTFS volume;
  • Capture a directory tree as a WIM image in a new or existing WIM;
  • Capture a NTFS volume as a WIM image in a new or existing WIM;
  • Mount an image from a WIM file read-only or read-write (Linux only);
  • Add or delete files from a WIM image without mounting it;
  • Extract individual files or directories without mounting it;
  • Delete an image from a WIM file;
  • Display information about a WIM file;
  • Change WIM image name, description, or bootable status;
  • Export image(s) from one WIM to an existing or new WIM;
  • Support for both compression formats used in WIMs (LZX and XPRESS);
  • Split a WIM file into parts, or join a split WIM into a standalone WIM;
  • Directly apply, export, or mount an image from a split WIM.

Wimlib isn’t available in the official Ubuntu repositories and the Launchpad PPAs I’ve found either don’t have Wimlib for all the supported Ubuntu versions or they have old Wimlib packages so to make it easier to install in Ubuntu (and derivatives), I’ve uploaded the latest Wimlib to the main WebUpd8 PPA.

Install Wimlib in Ubuntu via PPA

To add the main WebUpd8 PPA (note: our PPA has quite a few packages, so check out the package list before adding the PPA) and install Wimlib in Ubuntu, use the following commands:

sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install wimtools

Once installed, run «man wimlib-imagex» (for the command, you can simply use «imagex» instead of «wimblib-imagex«) in a terminal to see the available options. To create a customized bootable image of Windows PE, check out «man mkwinpeimg«.

Arch Linux users can install Wimlib via AUR.

Источник

Access the Windows file system through WSL!

Have you ever wondered, how to access the windows file system through WSL? If the answer is yes you are in the right place! Microsoft WSL has given us an incredible way to access the windows file system, you have just to navigate through an exact path to do it. Without further due, let’s dive into the topic.

1. Use the cd command in the Linux terminal.

cd /mnt/c/Users **OR** cd /mnt/d/your_folder/your_folder 

2. Moving files between the two systems through WSL.

If you want to move files between the two operating systems you can simply use the cp or mv commands.
cp — command for copying files
mv — command for moving files
Use of cp command

cp /mnt/c/file.txt /home/username/Documents 
mv /mnt/c/file.txt /home/username/Documents 

3. Editing windows files through WSL.

To edit windows files through the Linux terminal using WSL, you have to use any text editor that can be opened in the terminal. One of the most famous text editors is nano. In our example, I am going to use the nano editor.
Type into the terminal nano and the path to the file.

sudo nano /mnt/c/Users/file.txt 

4. Creating files in windows through WSL.

To create a file in a specific windows directory you have first to navigate to it and then use the touch command to create a file.
touch — a command that creates a file.
. The file extension can be anything you want.

cd /mnt/c/Users/Public/Documents/ touch filename.txt 

5. Deleting files from the windows file system through WSL.

To delete windows files using WSL, you have to navigate to the directory where the file lives and use the rm command.
rm — a command that deletes files / directories

cd /mnt/c/Users/Public sudo rm example_file.jpg 

Congratulations you learned 5 vital skills about working with the Linux terminal. 🎺🎺🎺
If you have any questions, comment down, I will answer as soon as possible.

Читайте также:  Linux системы учета трафика

Top comments (5)

A self-taught programmer and software enthusiast. In my free time, I enjoy walking and running on local trails, playing my guitar, and plant based cooking.

Nice quick guide! I got sick of typing cd /mnt/c/Users/Joe so I made an alias in .bash_aliases file I called called cdwin (takes you to Windows «home» folder»

  1. create .bash_aliases in your WSL Ubuntu home directory: touch .bash_aliases
  2. nano .bash_aliases
  3. Enter alias cdwin=’cd /mnt/c/Users/’ into .bash_aliases file
  4. ctrl + x and then Y to save aliases file.
  5. Create a symbolic link in bash shell: ln -s /mnt/c/Users/ win

Now you can get to «windows home» from anywhere by typing cdwin from within WSL Ubuntu.

2 likes Like Comment button

👋 Hi, I’m Ivaylo Ivanov 👀 I’m interested in AI, server-side, cybersecurity, and ethical hacking. 🌱 I’m currently learning Javascript, Node.js, Go, and Python.

That’s really cool little tip!

2 likes Like Comment button

Question: why would you ever run Windows in the first place?

2 likes Like Comment button

Thoughts on keeping working code files on the windows side to keep them in OneDrive? Is it overkill? Not everything deserves a place on github.

2 likes Like Comment button

👋 Hi, I’m Ivaylo Ivanov 👀 I’m interested in AI, server-side, cybersecurity, and ethical hacking. 🌱 I’m currently learning Javascript, Node.js, Go, and Python.

Personally, I think that GitHub is the best place to store your projects because it is well-integrated with code editors and meant to be used by programmers. If you do not want your work to be publically accessible on GitHub, you can always create a private repository, where only you are going to have access. I do not have experience with google drive for keeping coding projects on there, but certainly, I would prefer Github.

1 like Like Comment button

For further actions, you may consider blocking this person and/or reporting abuse

Читайте также:  Чем разбить диск linux mint

NextJS 13 – How to Web3?

Bernie January Jr. — Jun 26

How to build a LLM powered carbon footprint analysis app

Enhancing Your Laravel API with Treblle Platform

👋 Hi, I’m Ivaylo Ivanov 👀 I’m interested in AI, server-side, cybersecurity, and ethical hacking. 🌱 I’m currently learning Javascript, Node.js, Go, and Python.

Источник

Editing files in a Windows Subsystem for Linux development environment

The problem is that Windows apps cannot modify files inside the virtual lxss filesystem. Directly modifying these files is known to cause all sorts of issues.

Therefore, there seem to be only two suboptimal choices when it comes to using WSL for development:

  1. Store the project under lxss ( /home/foo ). The normal toolchain works properly. However, editing is limited to either terminal-based Vim/Emacs or whatever can be run under a janky X server, which is less smooth than native editors running on Windows.
  2. Store the project under the Windows filesystem ( /mnt/c/Users/foo ). Now any Windows-based editor can be used for development. However, the Linux-based toolchain is fragile as it’s not designed to be used on a «network drive», and can cause problems with file watching or databases.

Is there any way to get the best of both worlds here — that is, to be able to edit using a native Windows application, but still have the Linux toolchain work as it normally would on a local drive?

6 Answers 6

Microsoft has recently added comprehensive support for this, and it should be generally available in the April 2019 (19H1) update. Once it’s ready, a 9P server will run in the background whenever a Linux distro is running. The 9P server will be able to handle Linux filesystem metadata, and Windows will be able to treat it as a network drive so it can access it safely. You can read about it at https://blogs.msdn.microsoft.com/commandline/2019/02/15/whats-new-for-wsl-in-windows-10-version-1903/.

With the new feature, you’ll be able to safely access both Windows and Linux filesystem files from Windows, as long as you go through the 9P server. This will be handled natively from within WSL. For example, from the WSL command line you’ll be able to type code /mnt/c/Users/username/src/windows-file.txt to open a Windows file in VS Code, or type code /home/username/src/linux-file.txt to open a Linux file in VS Code.

If you’re not part of the Windows Insider Program, you won’t have access to this yet so you’ll still have to use an older method, such as wslpath.

wslpath will convert between Windows- and Linux-style paths so you can easily open Windows files from the WSL command line. As per https://github.com/Microsoft/WSL/issues/3146#issuecomment-388118689, it will refuse to convert Linux filesystem paths (i.e. %AppData%\lxss), because without 9P it’s unsafe to modify these files from Windows. This means you can’t open /home/username/src/linux-file.txt , but you can use code «$(wslpath -aw /mnt/c/Users/username/src/windows-file.txt)» .

In the past, there were a number of third-party tools to perform the same conversion but wslpath does it natively— in fact, ls -l /bin/wslpath shows that it’s just a link to /init.

Источник

Оцените статью
Adblock
detector