Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › The quick and dirty essential guide/glossary of terminal commands
New Posts  All Forums:Forum Nav:

The quick and dirty essential guide/glossary of terminal commands

post #1 of 46
Thread Starter 
EDIT/UPDATE: ALL COMMANDS WILL BE IN RED.

EDIT/UPDATE(5/10/2011)

SOURCES:
Thanks to Simple_echo for this as it's probably a better tutorial than the earlier one. It never hurts to add in another source.
http://www.ee.surrey.ac.uk/Teaching/Unix/

Been surfing around and I think I found something to compete with Jimi's post later in this thread.
http://www.unixguide.net/linux/linuxshortcuts.shtml
^That I think has just about everything for those of us new to the Linux world or still on the surface/end user level. It's old as heck (from what I can tell since it references netscape) but I think it's pretty useful.

MY editing of the second source:

I'll start off with some that I use everyday or rather frequently (feel free to correct me if I'm wrong or if you'd like to add more):

ls //This is the basic "list what's in a directory" command and something I usually follow cd up with to make sure I'm in the right place//

cd //Change directory command. Just "cd" by itself should take you back to the default directory. Following "cd" with a directory(folder) name will take you there. Depending on where you start from it might have to be the full pathname or if it within the same level directory you are in then it shouldn't. You can use "*part of folder name*" if you're lazy so you don't have to type it out. Or you can type a small part and hit TAB to have the rest fill in.//

rm //This is the "remove" command. See Jimi's post for more details.//

tar -xjvf //for files ending in tar.bz2//
tar -xzvf //for files ending in tar.gz//

UPDATE(4-8-2011): This is the start of what I have gathered from the link above. I'm skipping ahead to start with section 2. All credit for explanations goes to the authors in the link above.
Common Linux commands--system info

pwd
Print working directory, i.e., display the name of my current directory on the screen.

hostname
Print the name of the local host (the machine on which you are working). Use*netconf*(as root) to change the name of the machine.

whoami
Print my login name.

id username
Print user id (uid) and his/her group id (gid), effective id (if different than the real id) and the supplementary groups.

date
Print or change the operating system date and time. E.g., I could change the date and time to 2000-12-31 23:57 using this command:*
date 123123572000*
To set the hardware (BIOS) clock from the system (Linux) clock, use the command (as root)*setclock

time
Determine the amount of time that it takes for a process to complete + other info. Don't confuse it with the*date*command. E.g. I can find out how long it takes to display a directory content using:*time ls

who
Determine the users logged on the machine.

rwho -a
(=remote who) Determine all users logged on your network. The rwho service must be enabled for this command to run. If it isn't, run setup as root to enable "rwho".

finger user_name
System info about a user. Try: finger root

last
Show listing of users last logged-in on your system.

history | more
Show the last (1000 or so) commands executed from the command line on the current account. The "| more" causes the display to stop after each screenful.

uptime
Show the amount of time since the last reboot.

ps
(=print status) List the processes currently run by the current user.

ps axu | more
List all the processes currently running, even those without the controlling terminal, together with the name of the user that owns each process.

top
Keep listing the currently running processes, sorted by cpu usage (top users first). In KDE, you can get GUI-based Ktop from "K"menu under "System"-"Task Manager" (or by executing "ktop" in an X-terminal).

uname -a
(= Unix name with option "all") Info on your (local) server. I can also use*guname*(in X-window terminal) to display the info more nicely.

free
Memory info (in kilobytes).

df -h
(=disk free) Print disk info about all the filesystems (in human-readable form)

du / -bh | more
(=disk usage) Print detailed disk usage for each subdirectory starting at the "/" (root) directory (in human legible form).

cat /proc/cpuinfo
Cpu info--it show the content of the file*cpuinfo. Note that the files in the*/proc*directory are not real files--they are hooks to look at information available to the kernel.

cat /proc/interrupts
List the interrupts in use.

cat /proc/version
Linux version and other info

cat /proc/filesystems
Show the types of filesystems currently in use.

cat /etc/printcap
Show the setup of printers.

lsmod
(As root. Use*/sbin/lsmod*to execute this command when you are a non-root user.) Show the kernel modules currently loaded.

set|more
Show the current user environment.

echo $PATH
Show the content of the environment variable "PATH". This command can be used to show other environment variables as well. Use "set" to see the full environment.

dmesg | less
Print kernel messages (the content of the so-called kernel ring buffer). Press "q" to quit "less". Use*less /var/log/dmesg* to see what "dmesg" dumped into this file right after the last system bootup.
Edited by Rookie1337 - 5/10/11 at 3:28pm
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
post #2 of 46
man if you know that, you dont really need to know anything else lol

command line text file reading, less or more

text/script editing, vi vim nano or pico

./ for running a file in a directory

sh/bash/zsh/dash all that stuff for executing scripts

ln -s for creating symlinks

which for finding out what file runs when you type a command

find to find stuff duh

init or telinit to change runlevels

runlevel to check current run level

grep to cut lines out of text (soooooo useful for EVERYTHING)

ps ax | grep to check for a specific process

kill -9 to really kill a process

killall to kill a few processes

startx to start up your gui

ifconfig like windows ipconfig

dhclient or pump or w/e the other dhcp client is with your network card like dhclient eth0 to renew your dhcp stuff

im sure i can come up with more but i dont want to right now...

EDIT: sticky sticky sticky sticky SO WE HAVE AT LEAST ONE STICKIED! if it gets stickied throw some really nice structure into your first post
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
post #3 of 46
post #4 of 46
Thread Starter 
@Ent: Well I've sent one message out so we'll have to wait. But I'm liking your post. I'd quote it but since its right after mine I figure everyone should be able to see it. I'll get to work on my short list.

@Jimi: Thanks. I've never seen that before. But I was thinking a little more specific. For instance you may have a person (me) who would wonder, "Does this mean the order of -xzvf matters?". Still that's pretty nice.

Thanks guys. Anyone feeling like sharing your common/essential commands feel free.
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
post #5 of 46
well if it gets stickied, you know no one will look at anything past the first post just make a nice structure, catagorize them, give some useful info about each one maybe

use bold, colors, underline, bigger fonts, all that jaz lol
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
post #6 of 46
Thread Starter 
Well, apparently we need more info in this thread so now's our chances guys. Share you wealth of knowledge. Or if you want you can start a new one and we can get that one stickied.
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
     
CPUGraphicsRAMHard Drive
Intel Core m3-6Y30 Intel HD515 8GB 1866DDR3L Micron M600 MTFDDAV256MBF M.2, 256 GB 
CoolingOSOSMonitor
Fanless Win10 Home x64 Kubuntu 16.04 (requires Linux kernel 4.5/4.6) 13.3 inch 16:9, 1920x1080 pixel, AU Optronics A... 
CPUMotherboardGraphicsRAM
AthlonIIX4 640 3.62GHz (250x14.5) 2.5GHz NB Asus M4A785TD-M EVO MSI GTX275 (Stock 666) 8GBs of GSkill 1600 
RAMHard DriveHard DriveHard Drive
4GBs of Adata 1333 Kingston HyperX 3k 120GB WD Caviar Black 500GB Hitachi Deskstar 1TB 
Optical DriveCoolingOSOS
LG 8X BDR (WHL08S20) Cooler Master Hyper 212+ Kubuntu x64 Windows 7 x64 
OSMonitorPowerCase
Bodhi Linux x64 Acer G215H (1920x1080) Seasonic 520 HAF912 
CPUMotherboardGraphicsRAM
N450 1.8GHz AC and 1.66GHz batt ASUS proprietary for 1001P GMA3150 (can play bluray now!?) 1GB DDR2 
Hard DriveOptical DriveOSOS
160GB LGLHDLBDRE32X Bodhi Linux Fedora LXDE 
OSOSMonitorKeyboard
Kubuntu SLAX 1280x600 + Dell 15inch Excellent! 
PowerCase
6 cells=6-12hrs and a charger 1001P MU17 Black 
  hide details  
Reply
post #7 of 46
Code:
ifconfig eth0 | grep HWaddr | cut -d " " -f 11
saved that as a text file named macaddr

chmod 755 macaddr

throw it in bin and bam, type macaddr in your console and it kicks back the mac address of your first nic, you can also use the output in other stuff if you want lol

also not exactly command line entirely... but if you need that cool sudo password gui box that pops up with gnome, say if your making an entry into one of your menus, or you just want a gui sudo password box instead of doing it on the command line.... that tool is gksudo

hping3 is also a much improved and possibly more malicious version of ping can use any protocol, any type of packet, any size of packet, can manually set transmission speed, tcp/ip stack audit, run traceroutes under different protocols... its pretty awesome from a security auditing pov

rbash and rnano are symlinks to nano and bash usually, but nano and bash realize when they are called with the name rbash and rnano and they are a more secure sand box version of the programs

you can change timezone by deleting the localtime file in /etc and making a localtime symlink to a file in /usr/share/zoneinfo such as

ln -s localtime /usr/share/zoneinfo/US/Mountain

on a system with sysv startup scripts, you can check all your run levels services by cd'ing to /etc and typing

ls rc?.d

it will kick back each of the directories names, and all containing files (should be all symlinks to files located in /etc/init.d)

on that note you can also check out the scripts inside /etc/init.d to learn more about services running on your current runlevel, you can open any of them up with your favorite pager such as less or more, and see the options generally they will include stuff like stop and start, so you can do things like stop and start a service by typing out something such as

/etc/init.d/gdm stop

handy way to kill x on servers that use the gdm service

something most new users might not realize right away is that you use the mv command to both move files and rename files good thing to keep in mind if you are just starting out, its not necessary to open up a file browser such as thunar to rename and move files around

ls -laF

^^ thats my favorite form to get REALLY solid information about what is really ina directory, the -l puts it in list format, which i will commonly use if im checking out a certain file to check out its rwx permissions and where a symlink points to such as

ls -l filename

the -a lists all files, so hidden files proceeded by a . will show up that normally dont, such as your .bashrc in ~

and the -F shows file types at the end of the line, its kinda helpful but not entirely needed in most cases

with ls you can also look inside a directory from the directory it resides in... such as if your in ~ and you want to look into pictures, you dont have to cd pictures and then ls, you can just type ls pictures and it will list the directory name and whats inside of it

on that note, its useful to remember that ~ will take you right back to your specified home directory from the /etc/passwd file, or /root if your in a root shell and .. will take you up one directory, and those are valid directory paths so you can do things like cd ../.. to move up two directories, or you can cd ../difdir to move up one then change into another, or you can cd ~/pictures to move straight to a pictures folder inside your home folder

a very useful and some one unused tool imo is xargs and the back tick ` (key next to 1) you can do things like

find ./ -name "*~" | xargs rm

what that command will do is find all files ending in ~ from the current directory, and then pump each one of those lines via xargs into rm, so it will create an rm file~ line for each output line given by the find command you can also do pretty much the same thing with back ticks like this

rm `find ./ -name "*~"`

another useful one is nl or cat -n to number the lines of your output or text file a useful purpose with this is if you are having problems with a script or something and it gives you a specific line, you can easily check it without having to manually go through and count or find the line with something like this (# is your line number)

cat -n filename | grep #

a VERY useful thing to know is chmod for changing file permissions and stuff like that easiest way to use chmod imo is with the numbered form of permissions, you have to understand binary at least a tiny bit (not hard), and think of it as 000-000-000 thats owner-group-everyone, any of those 0s can be changed to a 1, and its counted like normal binary, first bit is 4, second is 2, and third bit is 1, so you get a number of 7 from all three being turned on, the first bit is read, second bit is write, and third bit is execute.. so if you want the owner to be able to do all three, but dont want anyone else to edit but have the ability to use the file you can

chmod 755 filename

alright... i think thats enough for right now... ill probably write down some more later
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
post #8 of 46
still bored, heres one more

for viewing log files in real time use the tail -f file

such as if you think some one is doing they shouldnt on your system or to your system, you can just open a new terminal and type out

tail -f /var/log/logfilename

and it will kick up the log file and every time a new line is added to the file it will also show in your terminal therefor viewing the log file in real time very useful to dedicate a terminal to if you are in charge of security over anything or just paranoid about some one hacking you or something lol

also for people who dont know the difference between symlinks and hardlinks... hardlinks arent advisable most the time in my opinion... what symlinks do is basically just point towards a file, what a hard link does is it creates another file pointing to the same inode of an existing file, with a hard link neither file is a more true file, they are the SAME EXACT FILE just in two spots.... some reason to do this could be like if you have thirty custom compiled versions of a program, that share some of the same files, you CAN hard link all of those same files to the same inode and save some disc space without causing any problems... however because of how a hardlink works, you cannot do it across file systems like you can a symlink symlinks are just easier and more convenient... so ln -s is your friend
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
post #9 of 46
WHY WONT OCN LET ME EDIT MY POSTS

but, i noticed an error in one of the lines i came up with when i was tired making the first post lol

can -n filename | grep #

that will return a bunch of junk also that you dont want... BUT if you do oh so need certain lines, here is a couple ways you can do it

nl -n ln filename | grep ^#

you can use regular expressions to grab a few lines around eachother so if your having trouble with a script you can pick out a small range like

grep ^1[3-7]

for lines 13-17 the ^ specifies the beginning of a line, and thats why you use the nl -n ln command to number the lines, it numbers and left justifies the numbers so you can easily pick them out with ^

another one some one told me AFTER i figured all that out >_>

is you can just use head to find the first like 17 lines, and then pipe that to tail for the last 4 lines, and yous till end up with 13-17... and if you want them numbered, you can start the pipe out with something like cat -n just to put the numbers in there
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
Kinda meh now...
(13 items)
 
  
CPUMotherboardGraphicsRAM
PhII 940 BE asus M4N82 Deluxe 2x 8800gts(g92) 2x 1g ocz ddr2 1066 
Hard DriveOptical DriveOSMonitor
/dev/sd[abc] /dev/sr0 WinXP/Linux 22in acer 
PowerCaseMouseMouse Pad
950w rosewill timebomb Antec 900 (2small) Voodoo Deathadder (RED!) X-Trac Pads Ripper XL 
  hide details  
Reply
post #10 of 46
http://books.google.com/books?id=gBG...ed=0CHIQ6AEwCw
NewMain
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i5 - 3550 Asrock Z77 Extreme4 Gigabyte GTX 760  4x2GB Corsair Vengeance 
Hard DriveOptical DriveCoolingOS
Seagate SATA 2TB x 2  Plextor PX-891SAW CM-Hyper N520 Slackware 14, Studio KUbuntu, OpenSuSe 12.3, Wi... 
MonitorKeyboardPowerCase
32" Vizio HDTV + DLP Logitech Wireless Corsair HX-850 Antec Sonata I 
MouseMouse PadAudioOther
Razer DeathAdder 2013 dual ESI Juli@ CoolGear ExtSata Enclosure w/ Optical and 3TB S... 
  hide details  
Reply
NewMain
(16 items)
 
  
CPUMotherboardGraphicsRAM
Intel i5 - 3550 Asrock Z77 Extreme4 Gigabyte GTX 760  4x2GB Corsair Vengeance 
Hard DriveOptical DriveCoolingOS
Seagate SATA 2TB x 2  Plextor PX-891SAW CM-Hyper N520 Slackware 14, Studio KUbuntu, OpenSuSe 12.3, Wi... 
MonitorKeyboardPowerCase
32" Vizio HDTV + DLP Logitech Wireless Corsair HX-850 Antec Sonata I 
MouseMouse PadAudioOther
Razer DeathAdder 2013 dual ESI Juli@ CoolGear ExtSata Enclosure w/ Optical and 3TB S... 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › The quick and dirty essential guide/glossary of terminal commands