Linux Tech Hacks

Your Linux tech hacks and Tips

Here's A List Of 83 Linux Commands For Beginners!

Here's A List Of 83 Linux Commands For Beginners!

Switching to Linux was a wonderful decision, now it's time to explore its power - the command line!


So you have just switched to Linux and trying to figure out what was the fuss about the command prompt as the most powerful tool. Well here's a list of Linux commands for a beginner to help you get a glimpse of what the command prompt can do for you. 

Viewing, copying, moving and deleting files

lsDisplay the contents of the current directory
ls -aDisplay also hidden files and hidden directories
  
cp filename /path/dir_nameCopy filename into directory /path/dir_name
cp -r dir_name /path/dir_name2Copy the entire dir_name into /path/dir_name2
cp filename1 filename2 /path/dir_nameCopy filename1 and filename2 into /path/dir_name
  
rm nameRemove a file or directory called name
rm -r nameRemove an entire directory as well as its included files and subdirectories
  
mv filename /path/dir_nameMove filename into /path/dir_name
mv filename1 filename2Rename filename1 to filename2
  
cat filenameDisplay filenames contents
  
more filenameDisplay filename in pages. Use spacebar to view next page
  
head filenameDisplay filenames first 10 lines
head -15 filenameDisplay filenames first 15 lines
  
tail filenameDisplay filenames last 10 lines
tail -15 filenameDisplay filenames last 15 lines
  
pwdDisplay current directory
  
cd /path/dir_nameChange to directory /path/dir_name
cd ..Go 1 directory up
  
mkdir dir_nameCreate directory dir_name
rmdir dir_nameDelete directory dir_name

Finding files and text within files

updatedbUpdate (create first time used) a database of all files under the root directory /
locate filenameFind file filename searching in the database
  
find / -name filenameStarting from the root directory search for the file called filename
find / -name *filenameSame as above but search for file containing the string filename
  
grep string /path/dir_nameStarting from /path/dir_name search for all files containing string
  
which application_nameSearch $path for application app_name
whereis application_nameSearch $path, man pages and source files for application_name

Archived files

Decompress
tar -xzf filename.tgzDecompress tzg file
tar -xzf filename.tar.gzDecompress tar.gz file
tar -xjf filename.tar.bz2Decompress tar.bz2 file

Compress
tar -czf filename.tar /path/dir_nameCompress directory /path/dir_name to filename.tar
gzip -c filename > filename.gzCompress /path/dir_name to filename.tar.gz
bzip2 -c filename > filename.bz2Compress /path/dir_name to filename.tar.bz2

Using rpm files 

rpm -hiv package.rpmInstall rpm called package.rpm
rpm -hiv --force package.rpmInstall rpm called package.rpm by force
rpm -hUv package.rpmUpgrade rpm called package.rpm
rpm -e package.rpmDelete rpm called package.rpm
rpm -qpil package.rpmList files in not-installed rpm called package.rpm
rpm -ql package.rpmList files in installed rpm called package.rpm
rpm -q strList installed rpms containing the string str
rpm -qf /path/application_nameDisplay the rpm that contains application application_name

Starting and Stoping 

startxStart the X system
shutdown -h nowShutdown the system now and do not reboot
halt
Same as above
shutdown -r nowReboot
rebootSame as above
shutdown -r +10Reboot in 10 minutes
   

Mounting filesystems

mount -t vfat /dev/sd(a)(1) /mnt/c_driveMount the first partition 1 of the first hard disk drive a which is in fat32 vfat dormat under /mnt/c_drive directory
mount -t iso9660 /dev/cdrom /mnt/cdromMount cdrom under /mnt/cdrom directory
  
umount /mnt/hda1Unmout the above

User administration

usersDisplay users currently logged in
adduser usernameCreate a new user called username
passwd usernameDefine password for user called username
whoList logged-in users
whoamiDisplay current user
finger usernameDisplays info about user username
suLog in as root from current login
su -Log in as root from current login and take root's path
exitExit from console login (ie, logout).

Processes 

commandExecute command in the foreground
command &Execute command in the background
ctrl+zSuspend a program
ctrl+cInterrupt a program
psList all processes
kill -9 pidKill process with id pid
topMonitor processes in real time

Networking 

hostnameList the system's hostname
ifconfigSet/Display network information
host ipResolves ip's hostname
ping ip/hostnameCheck if ip/hostname is reachable
traceroute ip/hostnameFind network path to ip/hostname
   

System Information

uname -aGeneral system information
fdisk -lList partition tables
cp filename /path/dir_nameCopy filename into directory /path/dir_name
df -T -hList filesystem disk space usage
lspciList PCI devices
lsusbList USB devices
free -mDisplay RAM+Swap usage

Program Compile

gcc -o output file.cCompile a C program
./outputRun a C program you have compiled
g++ -o output file.cppCompile a C++ program
./outputRun a C++ program you have compiled
./configure && make && su -c 'make install'Configure, compile and install a program with Makefile

List Courtesy: my-guides


Fonte: Here's A List Of 83 Linux Commands For Beginners!

Comente com o Facebook:

Nenhum comentário:

Postar um comentário

Siga-nos