Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
So I've been looking around on the web for some while now but this seems to be a tricky task.
I intended to change my default terminal on a Mint system from gnome to alacrity.
I had alacrity installed before on the same system and it seemed to be work fine.
I have not set up my root user or know the password for it so this makes this extra hard!
To change the default global behavior (e.g. pressing Crtl+Alt+T) modifying the /etc/passwd seemed reasonably to me.
This is what the last line looks now: user:x:1000:1000:User,,,:/home/user:/usr/bin/alacritty
But: If I want to open a shell now almost a thousand instances do appear once the command is triggered and after a short while the whole system crashes.
I don't know how to reset to the default setting since I need a shell and that tool is broken...
Here is what I tried so far
Try to use the shell env available at user log in: Login ends in an infinite loop
Try to open the /etc/passwd in graphical environment: Cannot modify the file (read only)
So here what I wish: Make this undone without reinstalling the operational system.
Thanks for your help and advice!
The field you are trying to change in /etc/passwd is used to set the per user shell (usually /bin/bash on Linux). The terminal emulator you want to use is can either be done with update-alternatives (system wise if you have root) on Debian based systems, or Window Manager specific configuration in general (GNOME, KDE, Xmonad etc).
Login in as root, and change the /etc/passwd file back to using a valid shell for the user in question. Not sure how you don't have a root user. If you don't have the root password then follow the normal password recovery process. Boot from a live or rescue cd. If it doesn't mount the file system for you, mount it manually then edit /mnt/etc/password (where /mnt is where the original file system was mounted). Unmount and reboot your system normally.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I wanted to install JDK on my linux machine, so I followed these steps: https://www.javahelps.com/2015/03/install-oracle-jdk-in-ubuntu.html
When I opened my /etc/environment file, it was empty, so I added PATH variable and the rest three variables from tutorial.
Since then it seems that all env variables are deleted so I cannot do almost any command including sudo, su, vim etc.
I am new with linux so I didn't know that would happen. I guess there were some default variables in case none of them are set?
Is there a way to restore that file?
And where were those PATH variables before? How is it possible that I overwrote them since I didn't delete anything?
My OS is Redhat Linux Server.
/etc/environment is used by PAM to override environment variable settings, so by putting a PATH in there which does not contain any default directories like /usr/bin, you effectively removed them.
It sounds like your OS does not use PAM to set the path if /etc/environment was empty, so you can probably restore things by deleting the PATH line you added. If that works, you can see what your 'normal' default PATH is, and add it back, along with the additions for oracle jdk
Failing that, just ensure that the PATH you define in /etc/environment contains at least /usr/bin and /bin (and perhaps /usr/sbin, /sbin, and /usr/local/bin.) A decent one is
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am attempting to use Windows 10 Bash as an alternative to PowerShell, as my requirements towards neither of them are high. As of now I am satisfied with quickly navigating the system and using tools such as grep.
To my question:
At this moment I attempt to open PDF files (or any files for that matter) using the Kali Linux Client of Windows 10. This means I run a Kali Linux Bash in Windows 10 and try opening a .pdf file located at C:\Folder\Subfolder\MyFile.pdf, similar to the way I am used to on my Ubuntu machine. The command does not appear to be working however. The command I use:
root#PC01:/mtn/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe /mnt/c/Folder/Subfolder/MyFile.pdf
Chrome will then open, however skips the file, i.e. it will open the default window. The path of the .pdf does autocomplete, indicating it is correct. For comparison: I can trigger Chrome along with the .pdf file I intend to open passed as parameter with this command:
PS C:\> & '.\Program Files (x86)\Google\Chrome\Application\chrome.exe' 'C:\Folder\Subfolder\Manual.pdf'
This PowerShell command works fine. It will open Chrome and Chrome in turn will open the filepath passed as parameter.
Is the reason this is not working in the Win10 Kali Linux Bash a mistake on my part? Or does Chrome run into trouble trying to interpret the path passed as parameter in the Kali Linux VM (I assume it is a VM, correct me if this is wrong, please), so that it cannot find the specified location?
My attempt to stringify the parameters was not met with success. Also I was able to find information on how to start Windows programs from the Linux bash, however not how to pass a filepath parameter properly, so apologies in advance if I happened to miss something.
Thank you, looking forward to the replies.
Even though you start Chrome through the bash shell, the program itself will not know how to handle the bash-style file path. As it is a Windows based program it will however know how to handle the DOS-style path.
So you can simply use:
/mtn/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe 'C:\Folder\Subfolder\Manual.pdf'
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I'm using Linux. I'm currently trying to set my current path location, as my home directory. Anyone have a clue as to what command I need to use?
The home directory has two different meanings, which usually are the same. The value of environment variable HOME (see environ(7)), and the field pw_dir given by password related API like getpwuid_r(3) on your current user id (obtained by getuid(2)).
At login, the HOME environment variable is set to the pw_dir and the effective and real user ids are changed.
To change your working directory to your HOME use chdir(2) on the result of getenv("HOME"). Notice that the working directory is not related to your PATH variable (which might mention .; but this could be a security issue), and each process (including your shell) has its own working directory (see also credentials(7), fork(2), execve(2), path_resolution(7), glob(7)).
To change your home directory (a very unusual requirement) you could edit -with root permissions- the /etc/passwd file carefully (see passwd(5)) then reboot your machine (or at least restart some login shell).
The bash cd builtin is doing that (changing the working directory of your shell process with the chdir system call). And when you use it without arguments you are changing your working directory to your home directory obtained by caching the result of getenv("HOME").
If performance matters that much inside some C program, you might cache (keep in some global variable, initialized once) the result of getenv("HOME") and use chdir on that.
If your question is simply about using your bash shell, just type:
cd
and that should (unless cd is badly aliased or redefined as some function) change the working directory of your shell to your home directory. It is done in a few milliseconds (so should be quick enough) at most (I can't easily think of a way to measure reliably how fast the cd shell builtin is; you could try time bash -c 'cd; pwd' or time bash -c 'cd; times' but that measures much more than just the cd and gives at most a few milliseconds on my desktop PC).
PS. the use of "quickest way" and "current path location" in your question is unclear and confusing. I strongly invite you to edit your question to improve its wording and motivate it and give more context.
I'm currently trying to set my current path location as my home directory. ? you can use EXPORT PATH.
for e.g Run below command in command prompt
export PATH=$PATH:$HOME/user
This changes happens only in current session, to make it permanent add it to .bashrc file.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
When I am using Awesome-WM under Linux Mint 13 "Maya" MATE, sometimes I need to open the File Manager "Caja". But when I launch caja, the wallpaper changes to the one I set under MATE instead of the one in rc.lua. I have tried
sudo gsettings set org.gnome.desktop.background draw-background false
but it seems useless.
How can I keep my settings under awesome-wm? Or I should set the 2 backgrounds the same?
You could try setting your wallpaper using feh.
Create a .fehbg file in your $HOME and put this in:
feh --bg-scale '/path/to/wallpaper.jpg'
..then save it.
Then in your autostart script just add sh $HOME/.fehbg & then try restarting your DE. If it still persists after opening Caja, then I am not sure about that since I am totally unfamiliar with Caja, rather, I am not familiar with MATE at all.
I think what's happening is that caja is set to 'manage' your desktop. That means it'll change your wallpaper to the one set in MATE, and probably display desktop icons as well, e.g., Computer, Home, etc. This has always been a problem for me when using alternative window managers on Ubuntu, because nautilus does it as well. With nautilus the behaviour can be turned off using the terminal flag --no-desktop. caja seems to be a descendant of nautilus and a quick Google shows references to the same terminal option for it as well. So I suggest you try
caja --no-desktop
and see if that works for you.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
My KDE is broken, the desktop Widgets cannot be displayed. And many KDE programs look like this:
All the software written in GTK is all right.
Can any one give me any suggestion about what's happening and which part is broken?
Where can I find error log?
You don't say what disto you're using (please add it to the tags in your question), nor how you got in this state - new installation? dist-upgrade? hard crash? That would be useful information.
But in general, here's what I would try:
Log out and go to a bare terminal with CTRL-ALT-F1, then login and rename your .kde / .kde4 directories: mv ~/.kde ~/.kde.old and reboot or otherwise restart your GUI system.
That will at least tell you whether the problem is messed up personal settings or messed-up system files.
If that doesn't fix the issue (that directory will be recreated when you start up KDE again; all your settings will be lost, but you can recover them - carefully, one by one - from the backup you just made), then I would first try sudo apt-get check (assuming you're on a Debian-based distro).
If that doesn't report any problems, then I would update my system - possibly even do a dist-upgrade without changes any sources.
If this issue still wasn't fixed, I would run sudo dpkg -l > ~/Desktop/dpkg_out.txt to get a list of installed or uninstalled packages and their state in a file, and then look through the file for problems as explained here.
Finally, if all of that failed, I would take a good hard look at my video drivers.
Good luck!