New answers tagged

0

I wrote this for Python, but you could do a better job with awk or bash, I'm sure: import commands,re def linux_musicplayer_check_whether_playing(): """ Report which applications are currently sending sound to the mixer, based on the output of the command: pacmd list-sink-inputs Also list those which are running/connected, but ...


-1

I suppose if you really wanted to do that, you could try using an alias like alias "sudo rm -rf --no-preserve-root /"="echo No." If that works, just throw that into your ~/.bashrc.


0

Try to view list of the installed MySQL parts. sudo dpkg -l | grep mysql and then try to purge them one-by-one. Looks like you have dependency problems and apt-get can't automatically resolve them.


0

Here are a few options you can try: yourcommand | sed 's/.*: //' > file.dat yourcommand | cut -d: -f2 > file.dat yourcommand | awk -F: '{print $2}' > file.dat yourcommand | grep -Eo '[[:xdigit:]]{2} [[:xdigit:]]{2}$' > file.dat


1

This is due to an incorrect graphics driver. First run: lspci -vnn | grep -i VGA -A 12 To see what type of graphics card you actually have. Since you have an Intel Graphics card and on 15.10, install the updated driver using this ppa sudo add-apt-repository ppa:oibaf/graphics-drivers sudo apt-get update && sudo apt-get dist-upgrade If all ...


1

Apps that appear in these menus will have .desktop files in one of these locations /usr/share/applications /usr/local/share/applications ~/.local/share/applications For example /usr/share/applications/tilda.desktop To clean your desktop menus of a removed app forever, you just need to delete the .desktop file. Here's a short way of doing it without ...


-1

Thanks a lot for everybody a=$(sed 's/\r$//' tempf.out) result=$(expr $a*2 | bc) echo $result works for me


0

You could pipe the output per line trough awk like following: echo "Notification handle = 0x000c value: FF FF" | awk '{print $6, $7}' which will result in this output: FF FF another pipe would allow you to put that into a file by appending echo "Notification handle = 0x000c value: FF FF" | awk '{print $6, $7}' | tee -a values.dat This would leave ...


2

If your tempf.out file has DOS-style line endings (CR-LF) then you will need to fix that - either at the file level using dos2unix, tr, or sed for example, e.g. a=$(sed 's/\r$//' tempf.out) bc <<< "$a*2" or by removing it from the $a variable using the shell's parameter substitution capabilities e.g. a=$(<tempf.out) bc <<< "${a%^M}*2"...


3

Welcome to Security Whack-A-Mole, the game where you try to enumerate ALL the ways you can get hurt, and try to wrap each one in bubble wrap. You can never win. Rather, learn to use Unix/Linux tools, understand what your system does, and don't run scripts (or anything) you don't understand (that comes from an untrusted-for-system-upgrades source). Your ...


1

You should not be expecting such output. For starters, Ubuntu didn't behave this way in earlier versions. Ubuntu was an upstart system for just under a decade, and the behaviour of the service command on Ubuntu has for all those years not resembled what you are expecting. One can see the upstart behaviour of the service command in the image in How do I ...


0

You can change the window size by changing the default geometry (rows x columns):


0

Edit > Preferences: See @steeldriver for explanation. Or On the command line, type: cd ~/.config/xfce4/terminal vi terminalrc Then edit the MiscDefaultGeometry variable to the size you would like.


-1

Make sure you sudo when running du. For instance, if you run du -hs /*, you won't see the real disk usage unless you add sudo.


1

There is a line in your ~/.bash_aliases that begins with ]#Curl. This is invalid bash syntax. Edit, with the editor of your choice, ~/.bash_aliases, find the line beginning with ]#Curl and remove the ]. This will change the line to #Curl ..., which is a Bash comment line.


0

First, log out and login by console with Ctrl+Alt+F1. Then backup & remove user settings (ignore warnings about ".." being busy): mkdir ~/old && mv ~/.* ~/old/ Copy default user files: cp -rT /etc/skel/ "$HOME" Type exit, return to graphic mode: Ctrl+Alt+F7 and login again. Done!


6

rm executable simply deletes the file executable from the current directory. rm executable &> /dev/null does the same, but it runs the command with output and error streams redirected to the special file /dev/null. That means you will not see any messages in the terminal. The /dev/null file they are redirected to instead is a virtual character ...


4

This append line to /dev/null only means that all output is omitted or better to say send directly into the data nirvana (or void, or bottomless pit). So the only thing that could change is that if this command runs into an error that you will see output for it on the screen.


1

You can use lshw to display memory information: sudo lshw -c memory It will display RAM as well as CPU caches, but you can quickly find the information you want. One example memory module could look like this: *-bank:0 description: SODIMM DDR3 Synchronous 1600 MHz (0,6 ns) product: ACR16D3LS1KNG/8G vendor: Kingston physical id: ...


1

It sounds like you simply don't have this alias defined. Aliases take precedence over hashed executables like gs, the presence of gs on your system wouldn't affect the alias at all. So, just add this line to your ~/.zshrc: alias gs='git status' Save the file, open a new terminal and you should be all set. Now, ghostscript is quite useful and you might ...


1

When in doubt about whether a command is a Bash builtin, an executable file, both, or something else: $ type -a kill kill is aliased to `echo 'You should not use kill - use OUPMclient -K instead.';' kill is a shell builtin kill is /usr/bin/kill kill is /bin/kill This is an peculiar example, since our provider wants us to use some other command rather than ...


3

Install pip for Python 2 by running sudo apt install python-pip # pip for Python 2 and for Python 3 by running sudo apt install python3-pip # pip for Python 3 I would discourage you from using easy_install at all if possible; to learn more, see the many great answers at http://stackoverflow.com/q/3220404/486919. Also note that the installation ...


2

ulimit and disown are Bash built in functions and those don't have a manpage of its own but are described in the Bash manpage. If you are running bash you can use the help command, e.g.: $ help disown You may want to pipe the output into less so you can scroll and search, e.g. $ help disown | less


11

When you type help you see the commands that are built in bash. To see help for these commands type help <command>: help ulimit help disown When you use man (short for manual), you display help for binary programs that are not part of bash. These are separate programs that bash executes them when you type the command. You noticed that you get the ...


13

disown is a bash built in. So man bash will show ... disown [-ar] [-h] [jobspec ...] Without options, remove each jobspec from the table of active jobs. If jobspec is not present, and neither the -a nor the -r option is supplied, the current job is used. If the -h option is given, each jobspec ...


1

Add these lines in Preferences -> Settings - User. It worked for me in Sublime Text 3. { "hot_exit": false, "remember_open_files": false } But, when we open Sublime Text from dash/search, all the projects/folders from the previous session are removed. You will get a new blank instance of Sublime Text.


1

Actually, ibus provides an system tray applet. Run ibus-setup On General tab, Check Show icon on system tray On General tab, confirm you have shortcut On Advanced tab,Uncheck Use system keyboard layout


0

Suspending from the session indicator in the top right corner of the screen can be replicated with the following dbus command. qdbus com.canonical.Unity /com/canonical/Unity/Session com.canonical.Unity.Session.Suspend I have used this dbus service before in other scripts and other answer on askubuntu. For instance, this has been used to determine ...


3

-- is commonly used to indicate end of options, in this case perl -- file.pl -ARGUMENT This is explained in the documentation A -- signals the end of options and disables further option processing. Any arguments after the -- are treated as filenames and arguments.


3

Moving the mouse to a defined (absolute) position ..is simply done by the command (e.g.): xdotool mousemove 200 200 To move the mouse to the centre of the screen however is a relative command, for which we need to read the screen's information and do some calculations. This is done in the two small scripts below. Straightforward version (move cursor to ...


0

Good news! On version 0.8.5, Guake will be displayed on the active monitor, so you don't have to tweak the Guake code anymore.


1

The command to remove a directory is rmdir not rm. So you just type rmdir TEST.


1

Ah, now I undersand! That's a fairly common request: All you need is to test for the existence of a given file, not its content. E.g. if you want to run the cron job, create a file say in yr home directory: $ touch /home/you/cronjob_enable. Then edit yr user crontab: $ crontab -e */5 * * * * /bin/bash -c 'test -e /home/you/cronjob_enable && /home/...


1

The command kill can be used to send a signal to a process. Useful signals, as in man, are: HUP, INT, KILL, STOP, CONT, and 0. Example: sudo kill -9 1234 - send signal KILL to process with pid 1234 top can be used to watch Linux processes. There is an option on this command to send signals to processes too. You should already know process PID: After ...


1

Exactly the same. They both need a PID and signal to send. By default they both send SIGTERM and you can pick another signal to send too.


2

For security reasons, commands, like sudo, that request a user's password set the terminal to "NO ECHO" so people surfing your shoulder cannot grab your password. The password you type goes to the computer, but the computer doesn't send the characters back to the terminal.


0

@heemayl and @bashBedlam Thank you. CTRL+L does what I want. But I am used to typing clear all the time. So I kind of worked around it by copying /lib/xterm/x/{xterm, xterm-256color} from ubuntu 12.04. There is an environment variable named $TERM that stores this file. Then I read your answer and tried CTRL+L and it worked. I got curious and was trying to ...


0

This question seems to be old, but for the cp command you've got the --verbose option. So the command works as follows: cp --verbose -rf /src/ /dsc/


0

The GUI is slow and it reflects changes only on refresh. Any command executed successfully from the terminal will always apply, its just the GUI which maybe a little slow to reflect it as a refresh of the view is to be triggered to get the newest entries.


1

Try using the DPKG program to verify those broken held packages. Man page extract -V, --verify [package-name...] Verifies the integrity of package-name or all packages if omit‐ ted, by comparing information from the files installed by a package with the files metadata information stored in the dpkg ...


2

Try sudo tar acvf /home/john/Desktop/KS_UserFolders.tar.gz \ --exclude='*.m4v' \ --exclude='*.m4a' \ --exclude='*.mp3' media/john/OS/Users/ Note that the archive file name must come right after the f option (without a -), and the --exclude options need two dashes. If you want it all on one line, it would be sudo tar acvf /home/john/Desktop/...


1

Turn on the autocd option (shopt -s autocd), so that you don't have to type cd. For example, you just need the two-character command .. to go to the parent directory. If you're navigating between two directories, you can toggle between them with cd -, which goes to the previous working directory. The autocd option doesn't make - run cd - but you can define ...


0

fish has several nice facilities for quickly moving around. If you type c d right-arrow enter, it repeats the most recent cd. By using c d up-arrow right-arrow enter, it repeats the second-most recent cd. Etc. It has prevd and nextd, which are often easier to use than pushd and popd. Also, I keep my favourite directories symlinked to ~/f, so I can cd ~/f/...


4

What you want is to type CTRL+L instead of clear. This will send a "Form Feed" to the terminal. Basically it will move everything up the height of the terminal window clearing the screen without affecting your scrollback.


2

You need to have the full directory in the /etc/environment for the PATH statement. /home/username/.config/composer/vendor/bin After the changes made, you need to reboot the host so that the changes in /etc/environment can take effect. Hope this helps!


4

export PATH=$PATH:~/.config/composer/vendor/bin works for the current session only. In ~/.profile and ~/.bashrc the ~/ doesn't get works within quotes, Either omit the quotes or use $HOME instead of ~/, e.g. export PATH=$PATH:$HOME/.config/composer/vendor/bin /etc/environment doesn't allow any shell syntax so neither ~/ nor $HOME works. Instead you need to ...


0

Although there are good answers above, I would like to give my 2 cents on how I use MATLAB in background. sudo -b matlab The -b tag of sudo can run applications in background. You can also close the terminal after executing this command. Probably, unrelated but there is wonderful website that you can use to explain shell commands. http://explainshell.com/...


0

If your on Xorg use xev: It opens a window that catches all events (incl. keystrokes) and displays the results, e.g.: enter code KeyPress event, serial 40, synthetic NO, window 0x5400001, root 0xc2, subw 0x5400002, time 29136757, (50,54), root:(1311,78), state 0x1, keycode 38 (keysym 0x41, A), same_screen YES, XLookupString gives 1 bytes: (41) "A" ...


0

Did somebody order a sledgehammer? This is pieced together from various other answers here. #!/bin/bash # Root required if (( UID )); then exec sudo "$0" "$@" fi cd /sys/bus/pci/drivers function reinit {( local d="$1" test -e "$d" || return rmmod "$d" cd "$d" for i in $(ls | grep :); do ...


0

Consider setting the CDPATH environment variable in your .bashrc or .bash_profile. CDPATH takes the same colon-delimited form that other PATH like variables take, and lets cd take shortcuts in finding your directories. For example: $ mkdir -p /tmp/foo/bar/baz $ CDPATH='/tmp/foo/bar' $ cd baz /tmp/foo/bar/baz



Top 50 recent answers are included