Linux Command Line – quick list
Linux Commands:
ls - list contents of a directory sudo - "substitute user" (grants administrator rights)sudo -i – login as superuser or admin or root
cd - change directory
aptitude - APT package management system (update, install, remove, search)
clear - clear screen
chmod - change file access permissions
chown - change file and group ownership
cp - copy
du -h - size of directory, h for human readable kbytes
grep - search (used as a pipe most often)
ex:cat example.php | grep -i cookie
ifconfig - shows IP address and other info about all interfaces including ethernet and wireless (may need /sbin/ifconfig if you are not logged in as root)
mv - move
rm - remove
cat - concatenate files (dump to screen)
ex:cat example.php | grep -i cookie
nano - basic text editor
vi - advanced text editor
fdisk - partition table manipulator (fdisk for windows and linux are different, their commands are unique to each platform!)
- ex: fdisk -l (list all drives)
df - disk free (remaining / used disk space) (df reports space used)
users - users currently logged in
useradd - add a user
usermod - modify existing user
uname - show system data (try uname -a)
mount - mount a file system, cd or removable drive
netstat -tpe (-t show only TCP connections, -p show PID/name, -e extra info)
umount – un-mount a file system, cd or removable drive
top - show current running processes touch - create new, empty, filereboot - reboot your system
shutdown - shutdown your system
passwd - change user password
ping - ping a network device or location (ping google.com)
more - show output one screen at a time
exit - logout of the terminal
eject - eject a cdrom or removable device
tar cvzf foo.tgz cps100 will tar the directory cps100 (and its files/subdirectories) into a tar file named foo.tgz.
To tar all .cc and .h files into a tar file named foo.tgz use:
tar cvzf foo.tgz *.cc *.h
find . -iname ‘filetofind.htm’
In Linux to create a playlist with all the *.mp3, *.wav, *.ogg and *.wma in the current folder (and all subfolders) use the command:
find . -iname '*' -print | sed -n -E -e 's/.*mp3/&/p' -e 's/.*wav/&/p' -e 's/.*ogg/&/p' -e 's/.*wma/&/p' > playlist.m3u
or this one:
find . -iregex '.*\.\(mp3\|wav\|ogg\|wma\)' -print > playlist.m3u
no comments yet.