Support Forums

Full Version: John's Useful Ubuntu Commands Mega-Thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
John's Useful Ubuntu Linux Commands

Sticky?

cd
Change the working directory.
Quote:$ cd /bin

chgrp
Change group ownership of files.
Quote:$ chgrp games moo.txt

chmod
Change access permissions of files.
Quote:$ chmod +x helloworld

chown
Change file owner and group.
Quote:# chown root lorem.txt

cksum
Print CRC checksum and byte counts of each file.
Quote:$ cksum lorem.txt moo.txt
Quote:3570240675 453 lorem.txt
4294967295 0 moo.txt

cp
Copies a file.
Quote:$ cp lorem.txt copy_of_lorem.txt

date
Outputs the current date and time.
Quote:$ date
Quote:Sat Mar 3 12:07:09 GMT 2007

df
Reports the amount of disk space used and available on filesystems.
Quote:$ df


dir
List directory contents.
Quote:$ dir
Quote:copy_of_lorem.txt lorem.txt moo.txt www

du
Estimate file space usage.
Quote:$ du -h /bin
Quote:7.8M /bin

echo
Display a line of text.
Quote:$ echo foobar
Quote:foobar

exit
Cause the shell to exit.
Quote:$ exit

fgrep
Print lines matching a pattern in a file.
Quote:$ fgrep "irure dolor" lorem.txt


find

Search for files in a directory hierarchy.
Quote:$ find hello*
Quote:hello_world
hello_world.c

free
Display amount of free and used memory in the system.
Quote:$ free


grep
Print lines matching a pattern.
Quote:$ grep -i apple fruitlist.txt
Quote:apple

groups
Outputs the user groups of which your account belongs to.
Quote:$ groups
Quote:games users

head
Output the first part of files.
Quote:$ head -2 lorem.txt

hostname
Outputs the machines hostname on the network.
Quote:$ hostname
Quote:Johns-Box

id
Outputs user id, group id, and groups of your account.
Quote:$ id
Quote:uid=1478(smallfoot) gid=100(users) groups=35(games),100(users)

kill
End a process.
Quote:$ kill -9 18298
Quote:-bash: kill: (18298) - Operation not permitted

killall
Kill processes by name.
Quote:$ killall irssi
Quote:irssi(18298): Operation not permitted
irssi(13372): Operation not permitted

irssi(22048): Operation not permitted
irssi: no process killed

last
Show listing of last logged in users.
Quote:$ last -n 3

ln
Make links between files.
Quote:$ ln -s data.txt symlink.txt

logname
Print user's login name.
Quote:$ logname
Quote:smallfoot

ls
List directory contents.
Quote:$ ls
Quote:copy_of_lorem.txt lorem.txt moo.txt www

man
Opens the manual page for a software or function.
Quote:$ man bash

md5sum
Outputs the MD5 hash sum of a file.
Quote:$ md5sum lorem.txt
Quote:56da9e37259af34345895883e6fd1a27 lorem.txt

mkdir

Makes a directory.
Quote:$ mkdir foobar

mv
Moves a file.
Quote:$ mv lorem.txt ipsum.txt

nl
Number lines of files.
Quote:$ nl lorem.txt

nm
List symbols from object files.
Quote:$ nm hello_world


od
Dump files in octal and other formats.
Quote:$ od -t x /bin/sh
Quote:2376640 00098020 000054d4 00000000 00000000
2376660 00000020 00000000 000000c7 00000008
2376700 00000003 080e6500 0009d4f4 00004ae8

...

pidof
Find the process ID of a running program.
Quote:$ pidof fetchmail
Quote:22392

ping
Pings a host.
Quote:$ ping -c 2 127.0.0.1

Quote:PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.052 ms

--- 127.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.048/0.050/0.052/0.002 ms

ps
Outputs running processes.

Quote:$ ps


pstree
Display a tree of processes.
Quote:$ pstree


pwd
Outputs the name of current working directory.
Quote:$ pwd
Quote:/home/smallfoot

rm
Removes a file or directory.

Quote:$ rm lorem.txt

rmdir
Removes a directory.
Quote:$ rmdir foobar

sed
Stream editor for filtering and transforming text.
Quote:$ echo "My cat's name is Bob" | sed -e 's/Bob/Mittens/g'
Quote:My cat's name is Mittens

sha1sum
Outputs the SHA1 hash sum of a file.
Quote:$ sha1sum lorem.txt
Quote:c942ddebd142ec8bacac9213d48096e74bab4957 lorem.txt

shutdown
Bring the system down in a secure way. All logged-in users are notified that the system is going down.
Quote:$ shutdown now

size

List section sizes and total size.
Quote:$ size /bin/bash

stat
Outputs file status.
Quote:$ stat lorem.txt


strings

Print the strings of printable characters in files.
Quote:$ strings hello_world


tail
Output the last part of files.
Quote:$ tail -2 lorem.txt

talk
Talk to another user.
Quote:$ talk bob Lookout for the dopefish!

touch
Change a file's access and modification timestamps. If file does not exist, create it.
Quote:$ touch lorem.txt

tty
Outputs the name of the current terminal.
Quote:$ tty

[/QUOTE]/dev/pts/16[/QUOTE]

uname
Outputs operating system, hostname, kernel version, date and timp, and processor.
Quote:$ uname -a
Quote:Linux Johns-Box 2.6.9 #1 SMP Wed Jul 19 16:24:18 MSD 2006 i686 Intel® Xeon™ CPU 2.80GHz GenuineIntel GNU/Linux

uptime
Outputs the system uptime.
Quote:$ uptime

users
Print the user names of users currently logged in to the current host.
Quote:$ users
[/QUOTE]alice bob charlie eve[/QUOTE]

vdir
List directory contents.
Quote:$ vdir


w
Show who is logged on and what they are doing.

Quote:$ w


wall
Send a message to everybody's terminal.
Quote:$ wall next week we change the server for a new one

wc
Counts lines in a file.
Quote:$ wc -l lorem.txt
Quote:7 lorem.txt

whatis
Search the whatis database for complete words.

Quote:$ whatis bash


who
Outputs who is currently logged into the system.
Quote:$ who


whereis

Locate the binary, source, and manual page files for a command.
Quote:$ whereis bash
Quote:bash: /bin/bash /etc/bash /usr/share/man/man1/bash.1.gz

whoami
Outputs your username / the name of your account.
Quote:$ whoami
fortune
Good commands, but one questions.

The second quote you put in each command means they are like an example of how to do it or a different command with a similar result?
Great post thanks, learning these now in college,cleared a few things up for me.
(10-09-2009, 03:52 PM)Acekidd01 Wrote: [ -> ]Good commands, but one questions.

The second quote you put in each command means they are like an example of how to do it or a different command with a similar result?

Most are examples of what happens when you run the command.
ps|aux One of the ones i use the most.
Good post. I personally have a handbook with most of the linux commands in but this will be useful for beginners to the terminal.