General :: Setup An Alias Or Shortcut To Do The *nix Find Command?
Apr 5, 2011
When at the command line, I find that I have to type out this command very often: find . -iname "*php" -exec grep -H query {} ; I'd love to set up an alias, script, or shortcut to make it work easier. I would like to do something like: mysearch query ("*php") (.) It would be great if the command could accept three arguments, in reverse order:
query string, file name expression, directory If the second two arguments were omitted they would default to not being included, and the current directory. Finally, the icing on the cake would be that if additional variables were included (4th, 5th, 6th...) they would be injected as additional arguments for the find command (like I could say -type d) at the end. Attempted code I tried the example below, but I'm still having trouble setting default values. What am I doing wrong?
#!/bin/bash
c=${param1+.}
b=${param2+*}
a=${param3+test}
find $c -iname $b -exec grep -H $a {} ;
View 1 Replies
ADVERTISEMENT
Jan 25, 2011
I have installed IDL 7.1 on my Ubuntu 9.10. And now the instruction says that I should set up an "alias" for it.I do not know what to write in my "bashrc" as an alias for IDL.
These are the place of the executable command of IDL:
/IDL/idl-7.1/bin/idl
AND
/IDL/idl-7.1/bin/idlde
Note that "idl" and "idlde" are the executable files which run the program by typing them in Terminal. I would be very grateful if anyone could help me in how to write an "alias" for my IDL.
View 7 Replies
View Related
Sep 25, 2010
I have an alias that I would like to use both as a regular user and as root, via sudo. Specifically, it is this:
alias rm=trash This works fine as a normal user, and it works fine when I use sudo -i to get a root shell prompt, but if I use sudo rm, the alias does not apply. So where do I need to put my alias so that it works in one-off sudo commands?
View 1 Replies
View Related
Dec 3, 2010
I used the alias command to make ll be ll -lrt. I have linux 5 and using the bash shell. now I can't even use ll, only ls. when I go into the bin directory, ll is not in the list and the normal color codes for bash are not showing either...folders blue, etc
View 4 Replies
View Related
Jan 28, 2010
I know that using alias I can run a whole command with a shortcut. But my requirement is to use parts of a long command and in between I have to pass some user defined values.
E.g. Suppose I have to routinely copy a directory to another remote directory on a remote machine.The remote machine name is quite long as well as the directory path to which I want to copy the files into.So the command to do scp would look like this[URL]Now I want to do some sort of aliasing (say "ecp") so that I just need to pass the source_directory name and the ecp command and do my job
View 3 Replies
View Related
Aug 9, 2011
I have a program which mounts /dev/sdb1 for which I lack the source code. This device does not exist on my RedHat 9 system and I want to create /dev/sdb1 such that it's an alias for /dev/hdb1 Can I do this? with MAKEDEV?
I need to have an alias which will allow it to mount, not create a symbolic link to an already mounted directory. i.e. 'mount /dev/sdb1 /mnt/harddrive' should actually mount /dev/hdb1
View 7 Replies
View Related
May 7, 2010
Is there any website that has complete list of all the shortcuts of applications/softwares of Windows, Mac, Linux Platforms. If Atleast for popular and veryuseful softwares.
View 1 Replies
View Related
Sep 19, 2011
Every time I need to start or stop Tomcat, I am navigating to:
/Tomcat_Dir/bin
and once I am in the folder I enter:
./Startup.sh
And to stop the server, I navigate to the same directory and enter:
./Shutdown.sh
I was wondering if there was a way in Linux to alias the above described process, so that from any location in the filesystem, I can simply type in something like
StartTomcat or StopTomcat to perform the Startup and Shutdown of the web-server?
View 2 Replies
View Related
Sep 12, 2010
I have fedora installed on my P4. Can anyboy tell me what is the Shortcut/Command for DisablingEnabling GUI on Fedora 8.0 ?
I have figured out that for disabling, we have the shortcut :-
ctrl - alt- f1
View 2 Replies
View Related
Jul 24, 2010
For example, I always go to this path:
/user/something/somefolders/somewhere
but I don't want to type
cd
/user/something/somefolders/somewhere
in the terminal all the time, can I have some short hand to do so? for example, can I do something like
cd commandPlace
to replace the path?
View 5 Replies
View Related
May 13, 2010
Im using Fedora Core 5.how to switch to command line from GUI using keyboard shortcut.
View 19 Replies
View Related
Mar 6, 2010
My current alias'd commands are:
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
I'd like to change 'ls' and add a few more, is there a command to permanently do that, or a config file I need to edit somewhere?
View 2 Replies
View Related
Oct 25, 2010
I have a few alias' in my .bashrc to save some typing, mostly ls type variants.
I wanted to add the following:
- give me a Long listing of ALL in Reverse Time order, (don't recurse directory)
Code:
But it doesn't work anything like the way it does on the command line
When I use the alias I get the following:
Code:
No Time, No Permissions, no group/owner ... , Why?
View 2 Replies
View Related
Sep 7, 2010
I have 4 Linux machines with cluster.My target is to find all kind of IP address (xxx.xxx.xxx.xxx) in every file in the linux system remark: need to scan each file in the linux system and verify if the file include IP address if yes need to print the IP as the following
more /etc/inet/file.example1
182.23.2.4
255.255.0.0
10.10.1.1
View 1 Replies
View Related
Sep 11, 2009
I am trying to do a find/grep/wc command to find matching files, print the filename and then the word count of a specific pattern per file. Here is my best (non-working) attempt so far:
wc `find . ( -name "*.as" -o -name "*.mxml" ) -exec grep -H HeightResizableList {}` ;
View 10 Replies
View Related
Jul 15, 2011
Is there a way to specify to find that I only want text files (and not binary files)? Grep has an option to exclude binary files, so I thought find probably has a similar feature, but I've been unable to find it.
View 2 Replies
View Related
Jan 25, 2009
I know how to search for normal files but can you let me know " How to search for 5 setuid files on the system. Also explain, for each file, why setuid mechanism is necessary for the command to function properly"
View 1 Replies
View Related
Aug 3, 2010
am new to linux and trying to find a file in sub directories using find command as:find .-name *.jpg -type fBut I am unable to get the result as find command is not permitted by the server administrator.Is there any way to find files without using find command.
View 14 Replies
View Related
Nov 30, 2010
I am using Gnome 2.32 (Ubuntu 10.10 /x64 ).
By using the supplied keyboard configuration utility I successfully set up two language layouts and they work perfectly. Since I also often work on Windows and default shortcut to switch layouts in it is Alt+Shift (and after many years I am very used to this), I tried to setup the same shortcut in Gnome. But with a Gnome I have a problem: once I press Alt+Shift - layouts switch immediately and I am unable to do Alt+Shift+<Something> shortcuts.
So my main question is:
Is it possible to teach Gnome's keyboard layout switcher to do the actual switch of layouts only if I press and release the Alt+Shift combination without touching any other keys?
View 2 Replies
View Related
Apr 11, 2011
I'm using Xubuntu 10.04 Lucid Lynx, and I'm trying to setup a keyboard shortcut for xfce4-terminal. I've read a million threads and articles telling me how to do it (go to settings >> keyboard >> application shortcuts tab and click add), but when I open that interface there is no "add" button, although the interface is a table that impliesn in its appearance that things can be added to it.
View 3 Replies
View Related
Jun 8, 2010
Whenever we insert CD,it creates a shortcut link in desktop.Can we list this link name by using any command? I am using Oracle Enterprise Linux 5.0.
View 10 Replies
View Related
Feb 6, 2011
I'm installing LoL using Wine and I can't find where setup has put the files. When I type "wine lol.launcher" it says "wine: cannot find L"c:\windows\system32\lol.launcher". For that matter I can't find where the setup program has installed any of the LoL components
View 1 Replies
View Related
Apr 21, 2011
I want to place a couple of launchers on my desktop so when I click them a terminal opens and runs the command how do I do this?E.g I want one for tail -f /var/log/messages, and another for rtorrent
View 2 Replies
View Related
Jul 26, 2011
I want to configure my keyboard shortcuts, but I need to get the commands for certain applications in the list. How do I do this? It appears I can't right click any icons that come up when I search for them.
View 9 Replies
View Related
May 30, 2015
how to enable the "move to trash" shortcut from the right click in Thunar? Is suddenly disappeared after some upgrading but I didn't remember exactly when.
Unfortunately this is a such cyclic problem...
View 1 Replies
View Related
Feb 22, 2010
I tried to install Lotus Notes 8.5 client on my opensuse 11.2 machine, the installation process goes smoothly but i couldn't find any short cut to run the software !!! nor in the desktop neither in the Recently Installed sub menu !!
View 7 Replies
View Related
Sep 26, 2010
i am using rhel 5.4..today i type the command setup! is not workERRor: error while loading shared libraries: libslang.so.2: cannot open shared object file: No such file or directory
View 5 Replies
View Related
Feb 13, 2010
Is there a way to set a specific terminal command as a keyboard shortcut? I know gnome-terminal opens the terminal, but is there a way to make a keyboard shortcut that opens the terminal and runs top?(I don't like how cpu heavy gnome-system-monitor is)
View 4 Replies
View Related
Apr 19, 2010
To install kde:
Code:
To groupinstall
Code:
Are those correct?
Any other command to install gnome/kde on Fedora?
View 5 Replies
View Related
Sep 18, 2010
I am pretty new to C.L.I/text editing work. So maybe its a bit old-fashioned but I am interested in learning how to send email via the command line. I am running 10.04 32 bit
Situation: I have followed the explicit and step-by-step actions at http://klenwell.com/is/UbuntuCommandLineGmail
Question: Upon completion, when trying to send a test email to myself via gmail (from CLI) I get the following error: "msmtp: no recipients found". In CLI below it asks me to explicitly pick a mailx to download. I think I already have mailx as when I type mailx I get "no mail for primary".
Here is my work
Code:
:~$ sudo apt-get install msmtp mailx
[sudo] password for:
Reading package lists... Done
Building dependency tree
Reading state information... Done
msmtp is already the newest version.
Package mailx is a virtual package provided by:
mailutils 1:2.1+dfsg1-4ubuntu1
heirloom-mailx 12.4-1.1
bsd-mailx 8.1.2-0.20090911cvs-2ubuntu1
You should explicitly select one to install.
E: Package mailx has no installation candidate
:~$ gedit ~/.msmtprc
:~$ chmod 600 ~/.msmtprc
:~$ gedit ~/.mailrc
:~$ echo -e "testing email from the command line" > /tmp/test_email
:~$ mailx -s "mailx gmail test" xxxxxxx@gmail.com < /tmp/test_email
msmtp: no recipients found
Here is ~/.msmtprc
Code:
# config options: [URL]#A-user-configuration-file
defaults
logfile /tmp/msmtp.log
# gmail account
#account gmail
auth on
host smtp.gmail.com
port 587
user xxxxxx@gmail.com
password xxxxxx
from xxxxxx@gmail.com
tls on
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
# set default account to use (not necessary with single account)
#account default : gmail
and here is ~/.mailrc
Code:
# set smtp for mailx
# gmail account (default)
# $ mailx -s "subject line" -a /path/attachment recipient@email.com < /path/body.txt
set from="xxxxxx@gmail.com (xxxxx)"
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"
View 4 Replies
View Related