New answers tagged

2

Tradition. The Single Unix Specification says (my emphasis): PS1 This variable is used for interactive prompts. Historically, the "superuser" has had a prompt of '#'. Since privileges are not required to be monolithic, it is difficult to define which privileges should cause the alternate prompt. However, a sufficiently powerful user should ...


3

Historically the original /bin/sh Bourne shell would use $ as the normal prompt and # for the root user prompt (and csh would use %). This made it pretty easy to tell if you were running as superuser or not. # is also the comment character, so anyone blindly re-entering data wouldn't run any real commands. More modern shells (eg ksh, bash) continue this ...


1

Much easier way would be to disable hashing of your known_hosts with HashKnownHosts no in your ~/.ssh/config to allow autocomplete from all history, or just list your hosts in your ~/.ssh/config (you can store there all your Ports and Users, or create aliases). I appreciate the creativity, but why to reinvent wheel when we have got already the same ...


1

So as I only and only want to know how to autocomplete my hosts targets within the bash_history file, I found this feature hoping to help anybody in the same situation. Just execute the following line $ complete -W "$(echo $(grep '^ssh ' .bash_history | sort -u | sed 's/^ssh //'))" ssh complete - is a bash builtin function. So there is not a binary on ...


0

The earliest version in the Unix history repository is credited to Ken Thompson in V7, on January 10, 1979. The 4BSD version only adds the CSRG's SCCS header, dated October 8, 1980. In the repository, the V7 version doesn't have a manpage; that appears in 4BSD.


4

This is impossible in general. Once an application has emitted some output, the only place where this output is stored is in the memory of the terminal. To give an extreme example, if this is the 1970s the terminal is a hardcopy printer, the output isn't getting back into the computer without somebody typing it in. If the output is still in the scrolling ...


2

Only if the terminal application was storing the raw output to a file somewhere, as e.g. iTerm does with logging enabled, or some other logging application (autoexpect(1) or equivalent) was saving the output will that raw output be available. Usually this has to be setup in advance, and requires management, e.g. if someone leaves yes running for a while then ...


0

When I originally started learning about computing, the RFCs were also one of my points of contact. My theory was that if I could understand the underlying network rules (of TCP, DNS, HTTP, etc) then I would be much better prepared to fix things when they went wrong. Or at the very least be able to pin point why they went wrong. An RFC is the rulebook that ...


-1

I'm not sure I would call it a technical reason, but the rule boils down to "the username must be a valid programming-language identifier". Identifiers have some nice properties due to their restricted syntax: They cannot be mistaken for numbers, even when reading characte by character, and they do not need to be quoted when going through a parser. In short, ...


1

Is there a technical reason why? Is this an artifact from the early days of Linux or Unix, and if so is there a reason why it persists? I cannot think of a technical reason - historically, it's just ASCII. How it is read in and then typed is in the hands of the coder. unix-history-repo/usr/src/cmd/passwd.c char *uname; insist = 0; if(argc < 2) { ...


3

No. It doesn't make sense to say the first version of Linux in particular was "based on parts of" Unix. It was not a port of the Unix kernel. It did not start with Unix code in the first versions [browse source] and replace it over time. Linus did not have access to Unix source code [interview]. What it copied from is the API. The same API is in the ...


0

It depends on your definition of "usable", but... a version derived directly from the very first irc client and server (the page only mentions the server, but the client is present in the download) can be found at https://people.symlink.me/~rom1/projects/oldirc/?view=list. It builds and runs on my system just fine (this is a release specifically modified to ...


1

This is also useful: history-search-backward Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. Might not be bound by default, but you can bind it and h-s-forward to e.g. page up/page down. Writing the start of a command line and hitting pgup/...


74

here is a test on ubuntu 14.04 using numbers: root@ubuntu:~# useradd 232 root@ubuntu:~# mkdir /home/232 root@ubuntu:~# chown 232.232 /home/232 root@ubuntu:~# passwd 232 Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@ubuntu:~# login c2 login: 232 Password: Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 4.4.0-22-...


122

Some commands (eg chown) can accept either a username or a numeric user ID, so allowing all-numeric usernames would break that. A rule to allow names that start with a number and contain some alpha was probably considered not worth the effort; instead there is just a requirement to start with an alpha character. Edit: It appears from the other responses ...


9

A *Nix username is generally a 32 character long string created by the utility useradd. This is, as you said, a direct result of early Unix (BSD technically) standards. According to the FreeBSD Man Page passwd(5): The login name must not begin with a hyphen (`-'), and cannot contain 8-bit characters, tabs or spaces, or any of these symbols: ...


4

Not exactly what you are asking for, but you can search through the history. Eg, ^R followed by ssh and then continue cycling through commands with ^R. (That's reverse search. Forward search is by default at ^S but that unfortunately collides with XOFF (undone with ^Q) for the typical terminal, so you probably want to remap that for it to be useful.)


4

This is possible. You want to investigate Ctrl-R and a little bit of history expansion. From man bash: reverse-search-history (C-r) Search backward starting at the current line and moving 'up' through the history as necessary. This is an incremental search. History expansions introduce words from the history list into the input ...



Top 50 recent answers are included