I am new to linux, and I was trying to figure out why I could not sudo with my username in Fedora 10. This command, when run as root, will add a line to the sudoers file allowing the loginname supplied to sudo. The above line will require a password when you sudo, if you wish to sudo without password, use: echo 'loginname ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers instead. you have to run this command as su, and this is just an easier way of using visudo, just adds it right from the terminal.
If you want to delete lines fast then all you need to do is vi/vim a text file, type in the amount of lines you want to delete (in my example I wanted to delete 10056 lines) followed by dd (no spaces). There will be no output so becareful with what number you type.
Installs busybox to an obscure directory on the HTC evo /data/wimax/login/bin
command to turn off your computer when you go home and can not wait Show Sample Output
Sometimes you want to know the summary of the sizes of directories without seeing the details in their subdirectories. Especially if it is going to just scroll off the screen. This one liner summarizes the disk usage of any number of directories in a directory without giving all the details of whats happening underneath. Show Sample Output
I often forget to type sudo before a command that needs it. This is the quickest way to rerun the command prefixed by sudo.
Print "Art of hacking..." 100 times by perl or you can this tools : http://packetstormsecurity.org/shellcode/shellcodeencdec.py.txt Show Sample Output
I absolutely love this website, and appreciate every contribution. This is the first place I go when I'm stuck, you all have some great ideas. But contributions seem to be slipping a little. If all of us could contribute more code from time to time, this site would be absolutely incredible. Since I'm a relative newcomer to commandline-fu, I don't have the knowledge to contribute much, but I will do what I can.
The script contains a single command: cd /a/long/directory/path/i/can/never/remember
Simply copies your public key to the remote system. For the first time, this will require a password for the user@remote account. From then on, ssh will ask for your private key keyphrase occasionally but you won't need to use the password. Very handy when you're moving files for testing etc.
get cpu info from dmesg
عرض الاتصالات لبورت ٢٢
( IFS=:; for i in $PATH; do echo $i; done; ) echo $PATH|sed -e 's/:/\n/g' # but the tr one is even better of course echo $PATH|xargs -d: -i echo {} # but this comes up with an extra blank line; can't figure out why and don't have the time :( echo $PATH|cut -d: --output-delimiter=' ' -f1-99 # note -- you have to hit ENTER after the first QUOTE, then type the second one. Sneaky, huh? echo $PATH | perl -l -0x3a -pe 1 # same darn extra new line; again no time to investigate echo $PATH|perl -pe 's/:/\n/g' # too obvious; clearly I'm running out of ideas :-)
In my work environment, we log onto the servers as our user ('user', in the sample ouput), and 'sudo su - root' to other accounts. This trick allows us to return the account name we logged in as -- and not the account name we currently are ('root', in this example).
Using this trick, you can build other commands:
Set your CVSROOT env variable to your account name:
CVSROOT=$(who am i | awk '{print $1}')@cvs.server.example.com:/cvsroot
SCP a file to another server:
scp file.txt $(who am i | awk '{print $1}')@some.other.server.com:.
This works out great in my environment, as we can include this in our documentation and make the comands more easy to copy/paste for different users, and not have to set all sorts of variables, or modify the docs for each user.
whoami gives you the name of the user you currently are, not the user you logged on originally as.
who gives you a listing of every single person logged onto the server.
who am i gives you the name of the user you logged on as, and not who you changed to with su.
Look at the following scenario:
whoami
user
su -
# whoami
root
# who am i
user pts/51 2009-02-13 10:24 (:0.0)
whoami != who am i
Show Sample Output
ghgh rty uty tr uyuyuyu
It will list all files in your home directory even if your current directory is not home directory Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: