How to retrieve lost aliases?
I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?
bash command-line alias bashrc
add a comment |
I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?
bash command-line alias bashrc
9
What if you just typealias
? It will show what you have defined.
– fedorqui
Jul 23 '14 at 15:04
3
Your next question is now required to be about setting up a backup system. :-/
– derobert
Jul 23 '14 at 16:06
2
Your next task, as soon as you've recreated your.bash_aliases
, is to set up version control for your dot files.
– Gilles
Jul 23 '14 at 23:02
@Gilles even better: unix.blogoverflow.com/2014/04/…
– strugee
Jul 24 '14 at 5:26
add a comment |
I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?
bash command-line alias bashrc
I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve them from this session?
bash command-line alias bashrc
bash command-line alias bashrc
edited 2 hours ago
Rui F Ribeiro
39.6k1479132
39.6k1479132
asked Jul 23 '14 at 12:58
MrUserMrUser
32229
32229
9
What if you just typealias
? It will show what you have defined.
– fedorqui
Jul 23 '14 at 15:04
3
Your next question is now required to be about setting up a backup system. :-/
– derobert
Jul 23 '14 at 16:06
2
Your next task, as soon as you've recreated your.bash_aliases
, is to set up version control for your dot files.
– Gilles
Jul 23 '14 at 23:02
@Gilles even better: unix.blogoverflow.com/2014/04/…
– strugee
Jul 24 '14 at 5:26
add a comment |
9
What if you just typealias
? It will show what you have defined.
– fedorqui
Jul 23 '14 at 15:04
3
Your next question is now required to be about setting up a backup system. :-/
– derobert
Jul 23 '14 at 16:06
2
Your next task, as soon as you've recreated your.bash_aliases
, is to set up version control for your dot files.
– Gilles
Jul 23 '14 at 23:02
@Gilles even better: unix.blogoverflow.com/2014/04/…
– strugee
Jul 24 '14 at 5:26
9
9
What if you just type
alias
? It will show what you have defined.– fedorqui
Jul 23 '14 at 15:04
What if you just type
alias
? It will show what you have defined.– fedorqui
Jul 23 '14 at 15:04
3
3
Your next question is now required to be about setting up a backup system. :-/
– derobert
Jul 23 '14 at 16:06
Your next question is now required to be about setting up a backup system. :-/
– derobert
Jul 23 '14 at 16:06
2
2
Your next task, as soon as you've recreated your
.bash_aliases
, is to set up version control for your dot files.– Gilles
Jul 23 '14 at 23:02
Your next task, as soon as you've recreated your
.bash_aliases
, is to set up version control for your dot files.– Gilles
Jul 23 '14 at 23:02
@Gilles even better: unix.blogoverflow.com/2014/04/…
– strugee
Jul 24 '14 at 5:26
@Gilles even better: unix.blogoverflow.com/2014/04/…
– strugee
Jul 24 '14 at 5:26
add a comment |
2 Answers
2
active
oldest
votes
You can almost definitely just do:
alias >>./bash_aliases
add a comment |
Easy trick
for alias in $(compgen -a); do type $alias; done
4
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
1
Combine this with redirection to a file ($alias
>.bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)
– trysis
Jul 23 '14 at 18:12
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f146109%2fhow-to-retrieve-lost-aliases%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can almost definitely just do:
alias >>./bash_aliases
add a comment |
You can almost definitely just do:
alias >>./bash_aliases
add a comment |
You can almost definitely just do:
alias >>./bash_aliases
You can almost definitely just do:
alias >>./bash_aliases
answered Jul 23 '14 at 14:27
mikeservmikeserv
45.5k668155
45.5k668155
add a comment |
add a comment |
Easy trick
for alias in $(compgen -a); do type $alias; done
4
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
1
Combine this with redirection to a file ($alias
>.bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)
– trysis
Jul 23 '14 at 18:12
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
add a comment |
Easy trick
for alias in $(compgen -a); do type $alias; done
4
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
1
Combine this with redirection to a file ($alias
>.bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)
– trysis
Jul 23 '14 at 18:12
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
add a comment |
Easy trick
for alias in $(compgen -a); do type $alias; done
Easy trick
for alias in $(compgen -a); do type $alias; done
answered Jul 23 '14 at 13:03
dchirikovdchirikov
2,89811015
2,89811015
4
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
1
Combine this with redirection to a file ($alias
>.bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)
– trysis
Jul 23 '14 at 18:12
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
add a comment |
4
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
1
Combine this with redirection to a file ($alias
>.bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)
– trysis
Jul 23 '14 at 18:12
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
4
4
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
You, sir or madame, are a life saver.
– MrUser
Jul 23 '14 at 13:06
1
1
Combine this with redirection to a file (
$alias
> .bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)– trysis
Jul 23 '14 at 18:12
Combine this with redirection to a file (
$alias
> .bash_aliases
, maybe with some file regexes to get it to the right place in the file) and you don't have to type it back into the original file yourself. (That is, if you haven't already typed it in.)– trysis
Jul 23 '14 at 18:12
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
While this works, I don't see the benefit over just using 'alias'. The format isn't particularly useful by comparison.
– moopet
Jul 24 '14 at 8:01
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f146109%2fhow-to-retrieve-lost-aliases%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
9
What if you just type
alias
? It will show what you have defined.– fedorqui
Jul 23 '14 at 15:04
3
Your next question is now required to be about setting up a backup system. :-/
– derobert
Jul 23 '14 at 16:06
2
Your next task, as soon as you've recreated your
.bash_aliases
, is to set up version control for your dot files.– Gilles
Jul 23 '14 at 23:02
@Gilles even better: unix.blogoverflow.com/2014/04/…
– strugee
Jul 24 '14 at 5:26