Tag Info

Hot answers tagged

36

It has gone nowhere, its in the current directory. It has been renamed as .... (four dots). As any filename having a . in front is treated a hidden file, so it has become hidden. So, if you do ls, you won't find it. Like always, you need the -a option of ls to view the hidden files i.e. ls -a to see it. Let me break it down, you ran mv filename ..\.. , the ...


32

You are not getting any files against those commands because they are shell (bash) built-ins, not separate executable files (e.g. binary files, scripts). Actually, shell built-ins are compiled into the shell executable; if you want you can check the source code to be sure of it. As which or whereis only looks for external executable files, you are not ...


10

Use Bash's command substitution $(), you also need -o with grep to only select the matched portion: cd "$(pip install django | grep -o '/usr.*')" Note that although you will get away in this case but you should always enclose the command substitution with double quotes so that the shell does not perform word splitting on whitespaces (by default space, tab ...


10

Sound I can't help you with. However, if you append something like && notify-send "Task complete." after your command, you should see a notification pop up in the upper right corner. If the required package is not installed by default, sudo apt-get install libnotify-bin should get it for you. The && will execute a second command if the ...


9

I'd use a find command something like this to target the deeper ABC directory, then mkdir -p to handle the directory structure, and finally rsync to mirror the contents (especially useful if you want to sync this up in the future). find . -mindepth 2 -maxdepth 2 -type d -name ABC \ -exec mkdir -p ../target/{} \; \ -exec rsync -a {}/ ../target/{}/ \; ...


8

Depending on what you do and don't know about the output of pip will be before you run your cd command, you might decide to grep for something other than /usr.*. If you know the directory starts with /usr (and that it appears at the end of the line of output from pip, and that /usr does not appear anywhere on the line before the directory name), then that's ...


8

With parted, you can just add the -s option: parted -a optimal -s /dev/sda mklabel msdos From the Trusty man page for parted: [...] -s, --script never prompts for user intervention [...]


7

It's part of bash's history interaction. A !! is substituted with the last command as is. A !foo is substituted with the last command that started with foo. A !^ or a !$ is substituted with the first or last arguments respectively in the previous command. A !n is replaced with the nth command in history. A !-n is replaced with the nth-last command in ...


7

Run mv .... filename to rename it back. (mv ..\.. filename would work too, but the \ is superfluous--as it was in your original command.) The file hasn't been deleted, which is why searching for recoverable deleted files didn't find it. Like in Windows, . and .. entries are present in every directory and refer to the "current" and "parent" directories ...


7

The pgrep command, and its sibling pkill, exists precisely for this purpose: pgrep firefox will list all processes whose commands match firefox pgrep -f firefox will list all processes whose entire command lines match firefox pgrep -x firefox will list all processes whose commands exactly match firefox ... and so on. And naturally, pgrep will exclude ...


7

Sure, with dosbox; enable the universe repository in Software & Updates then search it within Ubuntu Software Center, or run this command in a Terminal: sudo apt-get install dosbox Then switch to a TTY with, e.g. Ctrl+Alt+F1 and run it with this command: dosbox


7

If you just need to list the sudoers listed in the sudo group, I think that the best way to do it would be to run this command (which should be computationally lighter than any of the other commands in this answer): grep -Po '^sudo.+:\K.*$' /etc/group Also as suggested in the comments by muru, the format of the entries in /etc/group can be easily handled ...


6

ps -fC process-name example: ps -fC firefox from man ps -C cmdlist Select by command name. This selects the processes whose executable name is given in cmdlist. -f Do full-format listing. This option can be combined with many other UNIX-style options to add ...


6

You missed couple of points, the correct (Only syntatically) form would be: if [ `du -sh /tmp/filename.log` -gt 0 ]; then gzip /tmp/filename.log; fi There must be space after test ([) and before ] You need to put a ; (synonymous to newline) after first if condition You need to close the if condition using fi at last portion Also you should use $() ...


6

They are shell built-ins - you can get basic usage information by typing help fg or help jobs at the bash shell prompt, or more detailed information from the bash manpage.


5

The core of this question: Directories are case sensitive. Type cd /home/username/Downloads instead of lowercase. Additional information Finding out directory names: You can use ls to list files and directories in any directory , to see their names. For instance, on a fresh install, you most likely would find the following directories $ ls /home/newuser ...


5

The && operator executes the following command only upon success of the previous command / chain of commands. So the implications for those cases are: The script executes every command regardless The scripts executes sudo add-apt-repository example/program and sudo apt-get update regardless and sudo apt-get install example-program only upon ...


5

As it stated here I consider the simpliest way to discover with -l & -U options together, just type users it will list e.g.: John then: If the user has sudo access, it will print the level of sudo access for that particular user: sudo -l -U John UserJohn may run the following commands on this host: (ALL : ALL) ALL If the user don't have sudo ...


5

What you want is sudo apt-get update; alert. What follows is explanation and rationale. From the terminal, you can list many commands to be run in sequence. So what you want is first the command which takes a long time, and second a notification command. To run commands in sequence, you separate them with either && or ;. These have two distinct ...


4

Your understanding is basically correct. Both disown and nohup are used to allow you to exit a running shell session without stopping running jobs. Some clarifications: There's no reason to run nohup command & disown, nohup will already disown it for you. nohup is defined by POSIX while disown is not. This means that while many shells (e.g. bash, zsh, ...


4

All what you need is the power of awk and a for Statement: paste <(awk -F, '{ for (i = 29; i <= 188; i++) print $i }' PreRefFile.csv) <(awk -F, '{ for (i = 29; i <= 188; i++) print $i }' Txlog.csv) My test case: paste <(awk -F, '{ for (i = 2; i <= 3; i++) print $i }' foo1) <(awk -F, '{ for (i = 2; i <= 3; i++) print $i }' foo2) ...


4

As it has already been stated, the answer can be found on Unix & Linux Stack Exchange: This shows that user "saml" is a member of the wheel group. $ getent group wheel wheel:x:10:saml The only difference is that the group in Ubuntu is not wheel, but sudo (or admin in older versions of Ubuntu). So the command becomes: getent group sudo


4

This script terminates the terminal and thus the shell and himself. It mercilessly kills all processes. If you have multiple tabs open in a terminal, then these are also closed. The problem is, if several terminals are opened and these are child processes of gnome-terminal-server, all terminals will be killed. In this case, the script should be started ...


4

A good idea is to check his scripts with this tool. Here is an annotated version of your error: 1 #!/bin/bash 2 sed -rne '/21:25:07/,/21:50:07/ p' server.log.2015-04-21 > /tmp/filename.log ; 3 du -sh /tmp/filename.log ; 4 if [`du -sh /tmp/filename.log` -gt 0] then gzip /tmp/filename.log ; ^––SC1009 The mentioned parser error ...


4

Run a command as sudo, e.g.: sudo ls That's all.


4

If ; was used they would be the same, but && continues only if the command prior to it sends a exit code saying it exited successfully. It will automatically continue if all goes well, and will only stop to prompt the user to ask whether they want to add the PPA and whether they want to install the package. It may also work better than the ...


3

Use this command: notify-send "$(more /home/tim/autest.sh | head -4 | tail -1)" When you use your script with a shortcut, more gives this: :::::::::::::: /home/tim/autest.sh :::::::::::::: #! /bin/bash Here is an excerpt from the source code of more.c while (fnum < nfiles) { if ((f = checkf (fnames[fnum], &clearit)) != NULL) { ...


3

Adding to heemayl's answer, it's worth pointing out that fg, bg, and jobs have to be built into the shell, because they manipulate data structures in the shell's memory and/or the kernel state associated with the shell's process. It would not be possible to write an external command that does what fg does. Other commands that have to be built in include ...


3

It's a very short answer: !! repeats the last command, nothing else. More "funny" things can you find here. I have struggled to search for it because a Google for !! is fairly... pointless. And a better search for that is this: https://www.google.de/webhp?q=bash+cheat+sheet


3

it is still in the same directory, just a 'hidden' file now. You can recover it by "mv .... filename".



Only top voted, non community-wiki answers of a minimum length are eligible