Ubuntu :: Defining Custom Commands In .bashrc?
Apr 26, 2011
I'd like to know if there is a way to define commands in the .bashrc or .bash_profile. For instance, I want to be able to type 'work' in a terminal and set up an interactive work environment on my universities cluster. (This is done with the command 'qsub -I -X'.) I tried the following in my .bashrc file:
alias work ='qsub -I -X'
But, of course this failed, as I don't have a command work already defined. How do I go about doing this? Also, I can't assign 'qsub' an alias, since it's used with different options quite extensively.
View 5 Replies
ADVERTISEMENT
Sep 17, 2010
I need to occasionally touch a file with the current timestamp as the filename. I would do so this way:
touch `date "+%Y-%m-%d_%H-%M"`.txt
However, I'd like to define an alias for this. When I try adding to the bashrc this:
alias td="touch `date "+%Y-%m-%d_%H-%M"`.txt"
the result is that the filename is the same during the entire session, since the `date ..` gets calculated just once during login...
How can I get the command to expand only when I call the alias? Or must I use a function for this?
View 1 Replies
View Related
Apr 15, 2011
attending class in the Redhat Academy Website. I was wondering how can you join the two commands of cd/usr & ls successfully in the .bashrc file?
View 10 Replies
View Related
May 30, 2011
recently I did some changes to my bashrc file the changes are as follows
export JAVA_HOME=/usr/java/jre<version>/bin/
export PATH=$PATH:/usr/java/jre<version>/bin
now I'm unable even login to the OS.
View 9 Replies
View Related
Apr 29, 2011
So I'm here thinking how to create custom commands on my Linux Debian? I mean so i could open up terminal and just type the script name (and possibly some arguments) and it would refer to the script in my home directory. Otherwise I've write the whole path to the script each time and it gets annoying.
View 2 Replies
View Related
Apr 18, 2011
I found that Linux Ubuntu has custom keyboard commands.his is awesome.What I'm trying to do, is make a command that will shut down the computer with a single button with no dialog windows.For you know, being grounded nd stuff.I found the command for it is "shutdown" with a few options.But when I tested it, being bound to pause/break, it did nothingAm I writing the wrong code, as I'm not using any options, or is this not possible?
View 7 Replies
View Related
Jul 24, 2010
I would like to run a few custom commands when booting: "xinput" to calibrate the touchscreen and a couple of "setkeycodes" to make special buttons responsive.
From within a session I need to do "sudo setkeycodes [etc]" - without root access there's a "couldn't get a file descriptor referring to the console" error message.
Ideally these commands would already be operational at the login screen, and without requiring entering a root password every time.
I've put the commands in an otherwise empty /etc/rc.local but this does nothing. Other posts mention bootscript.sh but I don't get how this is used; and the best way to do this seems to have changed between versions - so what's the proper Lucid way?
View 3 Replies
View Related
Jan 11, 2011
I'd like to add custom startup commands (for example starting a process, registering to a registration server, downloading a configuration file) to the Linux startup process. Those commands should be triggered on startup only. What is the standard/appropriate way to do this?
EDIT: Is /etc/profile the right place to trigger such things?
EDIT2: I'm using Ubuntu.
View 4 Replies
View Related
May 11, 2015
I didn't change anything; it just stopped working on boot. I've changed permissions according to messages from log files. No good.I now get messages saying "unable to open display ' '." If I set the display (I've done this several ways, the messages say "unable to open display ':0'."
Systemd is taking control of everything basic, with almost no documentation and no configuration tools at all: rationalization by lunatics.You can make a script to run commands on boot using systemd on Jessie by creating two files: the script, in any location a file in /etc/systemd/system that runs that script..My script is called james-boot.service, placed in my /home/james/.bin directory.
#! /bin/sh
# this is run by /etc/systemd/system/james-boot.service
# Enable with sudo systemctl enable james-boot.service
# Check with sudo systemctl status james-boot.service
# If it says the service is loaded, it's OK -- inactive only means it's done running.
[code]....
This file must have ownership root.root, with (apparently) permissions 664 (rw-rw-r--).After creating, enable with sudo systemctl enable james-boot. service.Check with sudo systemctl status james-boot.service. If it says the service is loaded, it's OK -- "inactive" only means it's done running.
View 4 Replies
View Related
Jun 14, 2011
When I add some path in .bashrc by commenting out old path and adding new one like this:
#EXPORT HOME_PLAY=/home/gem/old_play
EXPORT HOME_PLAY=/home/gem/play
EXPORT PATH=$PATH:HOME_PLAY
After saving above changes, I enter the command: source ~/.bashrc Now if I do echo $PATH, the path shows both the old PLAY_HOME and new PLAY_HOME. This is really bad and messes up a lot of things in my project. This problem only goes away if I logout or reboot, a rather very long process. What is happening is that the old path is added to new path element and the old path includes the old path element you want to remove.
View 10 Replies
View Related
Mar 24, 2010
I am trying to use bash 'printf' to format an environment variable.Doing this I get on the screen just the format I need (underscores mean blank spaces):prompt> printf "%10s" "1.23"________1.23Unfortunately, when this is assigned to a variable, the format disappears:prompt> X=`printf "%10s" "1.23"`prompt> echo $X1.23Does anyone know what can be done in this case to get a proper format?Why does not 'printf' respect the left blank spaces when assigning values to a variable?
View 3 Replies
View Related
Aug 4, 2011
I'll come out and say I actually quite like unity, but it still needs a whole load of development. So I'm just wondering if anyone else knows how or why you can't bind Compiz keyboard shortcuts wile running unity. I'm trying to bind a shortcut (any) to Initiate a Window Picker for Window Group. If Unity is moving toward the Mac way of treating groups of windows that belong to the same program as an application it needs to have more options to manage those windows, being able to at least expose those windows would be a start. However I cant seem to put a keyboard binding for this function. I've tried <super>+<shift>+W and on a hunch that it was unity's Super that was messing it up <control>+<alt>+ and <super>+ and <alt>+W and <alt>+<shift>+W.
View 1 Replies
View Related
Jun 2, 2010
I need to replace JAVA_OPTS= with JAVA_OPTS=<some_value>.I need to give "" value at the end of the replacement. I have tried with the following but it is not working: sed -e "s|JAVA_OPTS= |JAVA_OPTS=<some_value>"
View 2 Replies
View Related
Aug 2, 2009
I have a server with 192.1.9.10 ip address and I want to define two gateways with ip: 192.1.9.4 and 192.1.9.254 on it but I don't know how I can do it. I don't have professional information in linux.
View 1 Replies
View Related
Dec 21, 2010
I use Persian language on my system and I really need two things:1. To define a custom layout for my keyboard. I am used to a layout that is not available in Ubuntu. Can I do that? (For example I need the system to enter a ****Ůž character instead of when I hit the backslash key)2. Defining a custom hotkey. I used a hotkey program in windows so I could enter no-space breaks with shift+space. Can I define that in Ubuntu
View 3 Replies
View Related
Apr 9, 2010
I am trying to make a periodic boundary condition type function, using an existing class given to me in lecture notes, but am having some trouble! Effectively, I am trying to make an array such that, for a point in any row of a 2D matrix ("Matrix(i,j)"), the command "next_i[i]" will return "(i+1)%L", where L is the number of data points in the row. This will enable me to select a point to the right of any point in the matrix: "Matrix(next[i],j)"
[Code]....
View 1 Replies
View Related
Feb 15, 2010
When one connects to an SSH server running on a non-standard port ( i.e. not port 22) it is straightforward to alter the command syntax so you can connect to this port. Is it possible to define the source port from the local machine ? For example, can you define the source port on your local machine to be 12345 as opposed to another port chosen by your system?
View 2 Replies
View Related
Aug 12, 2010
But what is the difference between this...
Code:
my_fucnction () {
echo "Hello World"
}
Code:
function my_fucnction {
[Code]...
View 10 Replies
View Related
Jul 6, 2011
I have a Radeon HD 5830, running 3 monitors on 10.10 64bit with the 10.6 video driver. The three monitors ( from left to right ) :
DFP1 : 1152x2048
DFP2 : 1920x1200
CRT1 : 1360x768
The problem I'm having is getting the middle monitor to be the primary one.
Running
xrandr --output DFP2 --primary
puts the panel on the middle screen but my docky and icons stay on the left screen. Flash videos also open up on the portrait left monitor which looks awful. Ideally I would like the icons on DFP1, docky on P2 and flash videos to open on P2. But I would definitely settle for everyone to be on the middle screen and drag it around as I please.
[Code]...
View 3 Replies
View Related
Nov 19, 2010
I am trying to install Ubuntu 10.04 into an existing partition. The other partition contains some backups.
When I get to step 5, the system freezes on the message that no root file system is defined. Correct this from the partitioning menu.
I have tried the options, but except for allowing the installation to take over the whole disc, erasing my backups, there does not seem to be an alternative way forward.
The following partitions are shown:
sda1 (fat16) 33,7 MB
sda6 (fat16) 26,2 GB
sda5 (ntfs) 53,8 GB
My backups are on sda5 and I am trying to install Ubuntu on sda6.
View 1 Replies
View Related
Dec 28, 2009
Just spent three whole days barking up the wrong tree, solving Fedora 11 and Fedora 12 boot failures because the correct hypothesis was illogical: installation did not update/modify the initrd.
The first couple of times I installed Fedora 11 on the HighPoint Technologies RocketRaid 2640x4, the installation inserted my "custom" driver module (rr26xx) into the initrd, permanently, so that the system booted off the controller card for which the custom driver was inserted. (I yelled about this success in this thread: [url]
My most recent installs of BOTH F11 and F12 on the RocketRaid failed to properly set up the boot. It turns out that the "rr2640" module I "slipstreamed" into the installation process was *NOT* permanently added to the initrd by anaconda. (F12 gave me "no root device found boot has failed, sleeping forever", on boot; F11 hung also, without such error, I presume, during the init script execution). Because of limited resources and time, I only know for sure the module was missing from the F11 initrd, and am ASSUMING the same was the case with F12.
The only difference between the successful installs and the ones with failed boot is that the successful installs were made on a single-drive (JBOD) mode on the controller; whereas, the failed ones were placed on RAID 5. But, AFAIK, the created logical device for the card is "/dev/sda", in both cases, and the kernel can not distinguish between the two cases (or can it?). Thus, the inconsistency cost me a lot of time, and is still inexplicable to me.
Question: What is the best way to deal with custom drivers, today? There are custom spins, and many tools, like isomaster. Stupid question: Is there a way to modify the initrd inside an installer ISO -- be it for CD/DVD/USBboot drive -- beefing the init RAM disk with whatever modules you'd like, for the boot process (using, say, isomaster)?
And what makes anaconda understand that a module must be added to the initrd ? How can one force anaconda to do so?
How does moving to dracut as the initrd tool affect any/all of the above?
View 1 Replies
View Related
Oct 24, 2010
I'm trying to modify my Linux server's Samba config so that each user gets their own private folder, in a similar way to having a private 'home' folder. Is it possible to create a samba share that maps to different places, depending on username? E.g if 'bob' connects they see the contents of /documents/bob and if 'fred' connects they see the contents of /documents/fred, and so on?
(I know this is what the [homes] share does, but I want another specifically for each user's private documents that won't get mixed with all the Linux user cruft such as dotfiles and things)
View 1 Replies
View Related
Jun 30, 2011
i have to define new dhcpd options to provide data for a pxe winpe boot. So these options will be under a bootstrap session. This doesn't work.
option ff code 145 = text;
option ff "test";
option sitepxe code 138 = text;
option sitepxe "test";
option clienthostname code 139 = text;
option clientMAC code 140 = text;
option bcdmenu code 252 = text;
In a wireshark capture i can't see the new options in the DHCPACK packet. ISC-DHCP is always restarted when the conf file is updated.
View 5 Replies
View Related
Apr 13, 2011
I have two identical webcams and I want to assign video0 and video1 to a particular one. I understand I can do this using udev but a bit stuck as being both the same they have the same attributes.
[Code]...
View 2 Replies
View Related
Jan 7, 2011
We are using Red Hat Enterprise AS 3.0. There are 100+ users connected to a single server. As the Inbox size of Mail Client (Thunderbird) for each user grows there are space constraint on the server. So I want to define a quota on mail folder for each user (say around 500 MB to 1 GB). How can I do this.
View 3 Replies
View Related
Aug 16, 2010
I just installed an ubuntu netbook edition on my notebook. In the installation process I defined a user with a password. I can use that password to access many system tools, like the synaptic package manager, adding users and so on..
However, when I wanted to do some staff in a terminal as a superuser (using the su command), and I enter my password (There is only a single user and a single password so far) I get authentification failure.
I went to System-->Administration-->uers and groups . I changed the my account type to an "Administrator" (for that I used again my password). hoping that I can use the su command but still it did not work..
I feel that the superuser needs to be set or defined. Since I have not done that then whatever pass word I enter after the command su I will always get "authentification failure"
How can I define the superuser and tell the system that I am the superuser of this computer?
View 14 Replies
View Related
Jan 4, 2011
I'm setting up Tomcat right now, and I've been directed to create a tomcat_home (catalina_home as of writing) environment variable.
Where is the default location for env variables in Slackware? My current inclination is to create a new script /etc/profile.d/tomcat.sh.
View 1 Replies
View Related
Apr 7, 2011
I recently upgraded from 11.3 to 11.4 succesfully. I had to reinstall several applications and, some of them, can't be configured as default from the control panel (e.g. Opera as default browser, VLC as default media player). The problem is that droplists at the prefered applications don't show any other than the default ones, Firefox and TotemIs there a way I can change these settings via command line or a way to fix what applications are shown at the control panel?
View 8 Replies
View Related
Nov 25, 2010
I have a problem defining persistent device naming on a Debian Lenny server.I have:RAID1 controller on the server machine with two SCSI disks.external storage with RAID5. I have / mount on the first partition on the server SCSI disk and /storage mount on the external storage. I'm experiencing a problem: The system recognizes the system disk (RAID 1), as sda or sdb randomly.I want: To control the recognition, and tell the system that sda (sda1) will always be the system disk.The motivation: GRUB is configured to work with sda, and when the system disk doesn't, boot process fails, and I end up in the initramfs shell-like interface.
Code:
Booting the kernel
.
.
.
mount:mounting /dev on /root/dev failed: No such file or directory
mount:mounting /sys on /root/sys failed: No such file or directory
[code]....
View 7 Replies
View Related
Apr 5, 2011
I am trying to modify a script for research purposes and am having difficulty here as I have little prior experience with C-shell scripting.
The script looks as follows (it includes tcl commands like runFEP that you can ignore)
#!/bin/bash
for ((old=1, new=2; old<=4; old++,new++))
a1=${old}%50
a2=${new}%50
do
cat > input${new}.conf <<EOF
${a1}
code....
My question: I keep getting a syntax error when defining my two variables a1 and a2. I essentially need these variables to be
a1 = value of variable old divided by 50
a2 = value of variable new divided by 50
View 1 Replies
View Related