---
title: " Java 开发必会的 Linux 命令"
author: "leobasic"
date: "2016-01-05T17:58:22Z"
tags: []
categories: ["互联网"]
slug: "java-linux"
draft: false
lastmod: "2016-01-05T17:58:22Z"
id: 2268722
url: "https://just2do.iteye.com/blog/2268722"
---

### 查看一个程序是否运行

`ps –ef|grep tomcat` 查看所有有关tomcat的进程

 

### 查看文件头10行

`head -n 10 example.txt`

### 查看文件尾10行

`tail -n 10 example.txt`

 

### 查看日志类型文件

`tail -f exmaple.log` //这个命令会自动显示新增内容，屏幕只显示10行内容的（可设置）。

 

 

### 查看端口占用情况

`netstat -tln | grep 8080` 查看端口8080的使用情况

 

 

### 查看端口属于哪个程序

`lsof -i :8080`

 

 

### 查看进程

`ps aux|grep java` 查看java进程