Try:
alias lock='gnome-screensaver; gnome-screensaver-command --lock'
or
lock() {
gnome-screensaver
gnome-screensaver-command --lock
}
in your .bashrc
The second solution allows you to use arguments.
More Related Contents:
- Make Bash handle variables like Batch
- Some troubles with using sed and awk [closed]
- Why would a correct shell script give a wrapped/truncated/corrupted error message? [duplicate]
- Add a new element to an array without specifying the index in Bash
- Lookup shell variables by name, indirectly [duplicate]
- How do I use su to execute the rest of the bash script as that user?
- How to iterate over associative arrays in Bash
- Why start a shell command with a backslash?
- How to process each output line in a loop?
- How to delete files older than X hours
- bash: force exec’d process to have unbuffered stdout
- Bash: Strip trailing linebreak from output
- Find and replace filename recursively in a directory
- How can bash script do the equivalent of Ctrl-C to a background task?
- What does it mean in shell when we put a command inside dollar sign and parentheses: $(command)
- How does bash tab completion work?
- How to add leading zeros for for-loop in shell? [duplicate]
- Running a Bash script over ssh
- Bash script store command output into variable
- How to resolve symbolic links in a shell script
- How to remove double-quotes in jq output for parsing json files in bash?
- Forward function declarations in a Bash or a Shell script?
- Expand variables in sed
- Exclude a string from wildcard search in a shell
- Looping through find output in Bash where file name contains white spaces
- How to use > in an xargs command?
- How to match a single quote in sed
- How to properly nest Bash backticks
- How to add path with space in Bash variable
- How to change a command line argument in Bash?